You’re trying to treat booleans as strings, which is fundamentally wrong. What you want is, for example, an array reduction:
$res = array_reduce($myarray, function ($a, $b) { return $a && $b; }, true);
// default value ^^^^
Or a more efficient short-circuiting all
function:
function all(array $values) {
foreach ($values as $value) {
if (!$value) {
return false;
}
}
return true;
}
if (all($myarray)) ...