Sample of the array after a recursive function [closed]

Welcome to Programming Tutorial official website. Today - we are going to cover how to solve / find the solution of this error Sample of the array after a recursive function [closed] on this date .

After some recursive function I have an array:

first iteration: Array ( [category_id] => 3 [title] => Aqua [parent] => 0 ) )

second: Array ( [category_id] => 5 [title] => Sea aqua [parent] => 3 ) Array ( [category_id] => 3 [title] => Aqua [parent] => 0 ) )

and so on…

How can I show only one array where [parent] => 0 ?

Answer

you probably want to do something like this:

foreach ($arrays as $arr){
  if ($arr['parent'] == 0){
     echo $arr['category_id'] . "n";
  }
}