• 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

printing all running session variable in laravel 5.1

Class AppHttpControllersUserController Does Not Exist

"Unable to load dynamic library 'pdo_sqlsrv.so' "Cenos7 PHP7.2.10

PHPMyAdmin not working as intended at remote server. Error 500, $respond not found

PHPExcel_IOFactory::createWriter causes wrong behaviour

Add bold text and line break into Laravel Notification Email

Failing validation doesn't stop code execution in livewire component

How to create a individual template for page or post in custom plugin?

How to execute sql code based on fetch array

PHP Get value from JSON [duplicate]

PHP function Not Working As Expected From functions.php Include File

PHP - Store information with NO database

Laravel Pagination links() not working

Add restriction to WooCommerce coupons by allowed user ID

How to update array value in Laravel

About Contact Privacy policy Terms and conditions