• 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

No definition found for function in vendor vscode

How to reset Laravel AuthManager/guards in between API calls in tests?

How to get the survey List from surveygizmo API in the Postman?(Trial Version)

How to create a cookie to store the timestamp of when a page is first loaded with php

Laravel Gates using model and returns "Using $this when not in object context" Line 28 of AzureUser model

Target class controller does not exist - Laravel 8

PHP Startup Unable to load dynamic library /usr/lib/php/20151012/php_mysqli.dll

Add a text next to stock quantity if it is less than 10 in Woocommerce single product

Phalcon: setStatusCode returns empty response

Error when uploading certain .png files "Interlace handling should be turned on when using png_read_image"

MySQL order by field in Eloquent

wp_remote_get() not passing authentication

Alert message after submitting form in PHP

IlluminateDatabaseQueryException could not find driver [duplicate]

How to solve cURL error 60: SSL certificate in Laravel 5 while Facebook authentication

About Contact Privacy policy Terms and conditions