Since after a few hours no one has answered completely, here is a complete answer to the question.
If you want to iterate over the entire array and count the elements, or perform operations on them the comment of @Barman is for you.
If instead you just want to do what the question asks, the best way is to stop the function as soon as it finds an array element with a null key value, avoiding unnecessary cycles.
So in this case is better to use the following code without considering the closures scoping of variables, but using a simple exception:
function check_if_the_array_has_not_empty_values($arr) {
try {
array_walk_recursive($arr, function($value, $key) {
if ($value == '') { throw new Exception; }
});
return 1;
}catch(Exception $exception) {
return 0;
}
}