• 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

Error converting docx to pdf using Unoconv

Use same method for inertia response and json response Laravel Jetstream

How can I access an array/object?

Update Total in checkout of Woocommerce with Ajax Request

How to get result of the formula on import xlsx with maatwebsite using Laravel? I get formula and not value of the formula

How to disable only_full_group_by option in Laravel

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

How to create a individual template for page or post in custom plugin?

Must be of the type array, null given,

Xdebug in Laravel is not working with VSCode

how to hide previous markers when new markers added in google map javascript api

PHPMyAdmin not working as intended at remote server. Error 500, $respond not found

Extract string between first whitespace and last whitespace in php

Populate Dynamic Dropdowns List in Codeigniter

How to get total pages of PDF with FPDF?

About Contact Privacy policy Terms and conditions