i'v 1 multidimensional array from where i just want to print where (parent==0) by counting. It suppose to provide me 2 value but when i write return method on line-32 it show me d 1st one & whn write on line-35 , it show me the last one. how can i get all value from this loop when i return it ?
$menu=Array(
Array(
'id' => 73,
'parent_id' => 0,
'title' => 'MENU_73'
),
Array
(
'id' => 74,
'parent_id' => 73,
'title' => 'MENU_73_74'
),
Array
(
'id' => 75,
'parent_id' => 74,
'title' => 'MENU_73_74_75'
),
Array
(
'id' => 76,
'parent_id' => 0,
'title' => 'MENU_73_74_76'
));
//Function to get Parents
$parent=0;
function getMenu($menu, $parent){
$list=array();
foreach ($menu as $key=>$value){
if($value['parent_id']==$parent){
$list[count($value)]=$value;
}
}
return $list; //line -35
}
$listParent=getMenu($menu, $parent);
print_r($listParent);