• 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 to implement placeholder in a php file for moodle plugin?

how to identify the web server name of remote host

Generate random username based on full name php

Require a class from another class - php

Malformed MIME header error in Symfony 5.3

How to increase the PHP upload limits [duplicate]

PHP password_verify

Adding custom body class to the custom archive pages

PHP only Hit Counter?

Shortcode or PHP inside a shortcode in Wordpress

XDebug not working in VScode for php debugging

LARAVEL: How to fetch id dynamically in a query builder?

OctoberCMS / Anonymous Global Scope

How to give apache permission to write to home directory?

Exact alternate to mcrypt_encrypt in PHP 7.2

About Contact Privacy policy Terms and conditions