• 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 mail sending empty mails

how to youtube api data to print in toolset metabox using a button click before save-post

PHP: Convert any string to UTF-8 without knowing the original character set, or at least try

PHP using str_starts_with for array to exclude same as with wildcard

Do I need to install `fxp/composer-asset-plugin` if I'm not doing front-end development

How to install LDAP in Docker php-fpm alpine

Make survey at laravel 5.4 and MySQL

Batch request Google Calendar php API

Access denied for user 'homestead'@'localhost' (using password: YES)

Target Individual Form Instance/Counter Inside A PHP While Loop

Uploading video to Youtube using Youtube Data API V3 and Google API Client PHP -- getting 401 (unauthorized) message

How to assert parameter attribute sub-structures in PHPUnit mock call expectations

Group rows by column and sum another column within groups [duplicate]

Debugging Stripe Webhook Event

Assign output of PHP function to a variable

About Contact Privacy policy Terms and conditions