Basically, I have a multidimensional array, and I need to check whether or not it is simply empty, or not.
I currently have an if
statement trying to do thi
If you don't know the structure of the multidimensional array
public function isEmpty(array $array): bool
{
$empty = true;
array_walk_recursive($array, function ($leaf) use (&$empty) {
if ($leaf === [] || $leaf === '') {
return;
}
$empty = false;
});
return $empty;
}
Just keep in mind all leaf nodes will be parsed.