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

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

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

android - How to create dynamically Fragment pager adapter -