• 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

PHP header location absolute URL

loop through an anchor id

nginx err_connection_refused, can anyone help me?

Apply filter array/return terms

Laravel relationship belongsToMany with composite primary keys

Symfony autowiring issues since docker update

oauth-private.key does not exist or is not readable

Is there a way to use the same parameter into multiple place in the same query with Eloquent? [duplicate]

MySQL upgrade causing unexpected results on simple WHERE clauses

wordpress : How to specify the cause "This site can’t be reached"

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

How can I access an array/object?

Laravel MSSQL Server Connection not working

Sliders in Laravel

Limit WooCommerce products in cart only from one custom taxonomy

About Contact Privacy policy Terms and conditions