• 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

backup files to google drive using PHP

How to convert binary string to normal string in php

PHP Slim Framework request using withAttribute error

"Notice: Undefined variable", "Notice: Undefined index", "Warning: Undefined array key", and "Notice: Undefined offset" using PHP

passwordless LDAP login and get user information using Kerberos ticket in PHP

how to identify the web server name of remote host

PHP returning an error message and false

Is it possible to change the table name in the migration file-laravel

XDebug not working in VScode for php debugging

I want to display a sweetalert after the inserting of data in my database

merge all files in directory to one text file

PHP: Telegram Bot: Insert line break to text message

Show rotation of tweets using current day of month

CodeIgniter extend CI_URI undefined method

How to change HTML structure inside WP <head>

About Contact Privacy policy Terms and conditions