• 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

Combine array with same value and add other [duplicate]

PHP: Calling MySQL Stored Procedure with Both INPUT AND OUTPUT Parameters (NOT "INOUT")

How can i call a function that executes an fpdf based on the choice of a form selector?

Laravel Multi-language routes without prefix

How to show selected value using javascript in laravel

Calculating Median of an array in PHP

Can't find vendor/autoload.php for Ratchet

Whats the point of running Laravel with the command 'php artisan serve'?

wp_remote_get() not passing authentication

how to redirect the user back to desired URL after login page in PHP?

How to use a PHP MVC Controller, one thats invoked by calling a URL, to call and execute more than one function? [duplicate]

Laravel 5 issue with wherePivot

PHP array stringify

Symfony run hint kernel.secret parameter not found

Override default Auth routes in Laravel 7

About Contact Privacy policy Terms and conditions