• 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 should I get started using PHPUnit as a testing framework for a bunch of functions and classes I have already made?

Appending data to an anchor tag

MySQL order by field in Eloquent

generate an Excel file using PHP

Issue with laravel eloquent model property

Live search query using JS and PHP for QA forum

Laravel phpunit test failing authorization

using random function but it's displaying duplicates

Call authenticate manually in router middleware

Passing a boolean value from checkbox in Laravel form

How to increase the PHP upload limits [duplicate]

Image upload not working through ajax Laravel

How to modify CSS in a specific page of the WP admin dashboard (backend)

Apply session id from request header

Loading data from MySQL and populating dropdown select with jQuery Mobile, PHP

About Contact Privacy policy Terms and conditions