• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

How to loop a tree array with unknown depth and get array blocks?

phpmultidimensional-arraytree


PHP Snippet 1:

function saveAllValues($arr) {
    save_to_db($arr['id'], $arr['name'], $arr['is_master'], $arr['master_id']);
    if ($arr['has_children']) {
        array_map('saveAllValues, $arr['nodes']);
    }
}

Related Snippets

Get sql.h error on MacOS 12 (Monterey) sqsrv and pdo_sqsrv drive installation

retrieve data from database using session

How to send upload image through email

Call to a member function givePermissionTo() on null

Nginx disallowing execution of PHP in uploads directory with Magento

selected value from the listbox in php

The "client_reference_id" argument is not passed

Alert message after submitting form in PHP

Laravel 5.5 change unauthenticated login redirect url

How to identify whether webp image is static or animated?

Laravel 4 Redirect::back() not going to previous page (refreshing current page)

How can I convert from a{a{} b{}} to a[a[],b[]] using php preg_match?

how to remove %20 in the url in php

PHP cURL (SSL certificate problem: self signed certificate in certificate chain)

file_get_contents() without "Http" to access external URL [closed]

About Contact Privacy policy Terms and conditions