• 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

target [LaravelFortifyContractsRegisterViewResponse] is not instantiable

Transpose multidimensional array and join values with commas

PHP Include for HTML?

Display the WooCommerce product price inside a custom function

Two buttons one form

laravel MVC execution flow

Submitting a form with ajax in Wordpress

Form Validation and Submission to database

Project structure for PHP

Make Calculator - When Button clicked the No shows in Textbox.

php 7 php.ini upload_max_filesize not working

Printing more than one array using print_r or any other function in php

Telegram bot doesn't answer

Unsure why I am getting: Number of variables doesn't match number of parameters in prepared statement

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

About Contact Privacy policy Terms and conditions