I have a function which checks the children on a tree given the parent ID:
function categoryChild($id) {
$mysqli = dbConnect();
$query = "select folders_id, childof from folders where childof = $id";
$result = $mysqli->query($query);
$children = array();
if(mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_array($result)) {
$children[$row['folders_id']] = categoryChild($row['folders_id']);
}
}
return $children;
}
If I use: print_r(categoryChild($folder_id));
I get e.g. the following:
Array ( [21] => Array ( [22] => Array ( ) ) [24] => Array ( [25] => Array ( ) ) )
I want to be able to check simply check against the numbers in the array(s)...I've tried:
if(in_array ("25", categoryChild($folder_id))){
echo 'yeah';
};
But it simply does nothing.
Is there a way to do this?