• 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

How to fix " Uncaught TypeError: Argument 1 passed to JpGraphException::defaultHandler() " problem in php 7.1.3 and jpgraph 4.2.6?

Only on Firefox "Loading failed for the <script> with source"

Why does codeigniter & Linux server throws unserialize() session data error when user tries to login

Cache clear probem in Larave

add_action() function in wordpress not working [duplicate]

PHP Startup: Unable to load dynamic library 'openssl' in Ubuntu

Could not decode a text frame as UTF-8.

What is my SQL missing?

Changing font color in javascript

XAMPP/SQLSRV: Unable to find Sqlsrv in PHPINFO(); - errors coming from connection

Creating Combinations of Elements

Yii2 redirecting to previous page after login

Using if(isset($_POST['submit'])) to not display echo when script is open is not working

PHP to search within txt file and echo the whole line

Symfony there are no commands defined in the "make" namespace

About Contact Privacy policy Terms and conditions