An array of "categories" is given:
$categories = array(
array("id" => 1, "title" => "Pants", "children" => array(
array("id" => 2,
"title" => "Boots",
"children" => array(
array("id" => 3, "title" => "Leather"),
array("id" => 4, "title" => "Textile"),
),
),
array("id" => 5, "title" => "Sneakers"),
),
),
array(
"id" => 6,
"title" => "Sort",
"children" => array(
array(
"id" => 7,
"title" => "Balls",
),
),
),
);
I need to write a function searchCategory ($categories, $id) that returns the name of the category by the category ID.
Help me please.