• 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

onKeyUp event calculation not working on the following rows from php generated forms except the first one

Entity provider not working in security.yml php symfony3.4 ({"code":401,"message":"bad credentials"}.)

How to create a scheduler application in php

How do I call Validator from a namespace with an already existing Validator class

Uncaught TypeError: Cannot read property 'length' of null when retrieving tags from wp

Laravel 5.1 xmlHttpRequest AJAX POST TokenMismatchException

Laravel/ PHP: Order By Alphabetical with numbers in order [duplicate]

Show date difference as "20" instead of "20 years ago"

Vimeo API: how to save a vimeo into a subfolder?

How to remove Deprecated SymfonyComponentDebugDebugClassLoader?

Trying to iterate over a mongodb cursor twice - failing

How can I format this number correctly using PHP?

Symfony run hint kernel.secret parameter not found

Handling expired token in Laravel

How can I make this nested location configuration use the correct path to call a php program?

About Contact Privacy policy Terms and conditions