• 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

Laravel Livewire: jQuery not working in child component loaded via @if statement

using random function but it's displaying duplicates

Transpose and flatten two-dimensional indexed array where rows may not be of equal length

Check If array is null or not in php

Results page in other window

Clear javascript source cache laravel 5.8

No result using makeStyles Material UI in react 18

RabbitMQ PRECONDITION_FAILED - unknown delivery tag

Composer fails with kylekatarnls/update-helper on new homestead

Shopify password update using Shopify API

Composer Curl error 60: SSL certificate problem: unable to get local issuer certificate

How to create a scheduler application in php

How to convert the int value to inch in PHP [closed]

Creating command to backup MySql database in Laravel

How to convert time from one timezone to another in PHP

About Contact Privacy policy Terms and conditions