I have an array, here is an example , and I want to get all data from (content && children). But in children I can have another (content && children) ,and so on.. If I use foreach ,I can get data just from level 1 or 2 (I don't want to use to many), so I don't get data from last level. I tried to use array_walk_recursive , but I don't get the correct data.
The data from the link is from json_encode($fulljson)
public function array_rec($item, $key)
{
return "$key holds $item\n";
}
public function handlerData(){
Log::info('Test:' . array_walk_recursive($fulljson, 'self::array_rec'));
}
//output will be Test: 1