• 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

WAMP/Wordpress - cURL error 28: Operation timed out after 10001 milliseconds with 0 bytes received

Statement that checks whether a URL contains a particular path?

how to remove %20 in the url in php

Twig - How to check if variable is a number / integer

hidden INPUT value not available in $_POST

PHP Warning: Module already loaded in Unknown on line 0

How to convert binary string to normal string in php

How to solve Duplicate entry '0' for key 'PRIMARY' in Wordpress?

How to send parameters in soap request in php in __soapcall() function

Split array into 4-element chunks then implode into strings

renameColumn migration fails for existing column with columns does not exist error

How to average columns of data from multiple, flat arrays?

How to programmatically find public properties of a class from inside one of it's methods

Convert string to lowercase AND then convert it to its original form in PHP, is it possible?

Transpose multidimensional array and join values with commas

About Contact Privacy policy Terms and conditions