php function returns null instead of string
问题 I have an array with all categories stored in it: $allCatArray = array( ['departments/outdoor/123123/'] => stdClass Object ( [i] => 1 [id] => 'departments/outdoor/123123/' [pid] => 'departments/outdoor/' [name] => 'Child Category Name' ) ['departments/outdoor/'] => stdClass Object ( [i] => 1 [id] => 'departments/outdoor/' [pid] => '0' [name] => 'Main Category Name' ) I need detect the highest category in hierarchy when i have id of lower category in hierarchy. So I have this function: