I need to do "foreach" action only for the highest parent nodes in my PHP array.
In this example I would like to get echo of the family lastnames...
$families = array(
'Brooks' => array(
'John',
'Ilsa',
),
'Hilberts' => array(
'Peter',
'Heidy',
));
foreach($families as $family){
// do some action that will return only "Brooks,Hilbers"
// not "Brooks,John,Ilsa,Hilbers,Peter,Heidy,Brooks,John,Ilsa,Hilberts,Peter,Heidy"
}
Is is handable, or should I define the array differently? Thank you very much for any positive answer.