It will return true if all values โโare true, otherwise false.
Returns true if the array is not empty and does not contain false elements:
function array_and(arary $arr) { return $arr && array_reduce($arr, function($a, $b) { return $a && $b; }, true)); }
(Note that you need a strict comparison if you want to test it with type false .)
Can i overestimate
Yes, because you could use:
in_array(false, $arr, true);
Matthew
source share