PHP: Find depth of current array in recursive function -


is there way can current depth of array? far, had no luck this..

my code:

use app\components\treeview; use app\models\kategorije; $tree = treeview::getmenu();  function recursion($stablo,&$indent) {     $indent++; // try depth of current array     foreach ($stablo $value) {         foreach ($value $key => $value) {             $indent_str = str_repeat("-", $indent);             echo $indent.$value['label'].'<br>';             if (!empty($value['items'])) {                 recursion($value['items'],$indent);             }         };     } } $indent = 0; recursion($tree,$indent); 

i need depth indentation...


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -