How can I check if all elements in an array are true
, or if all elements are false
?
Ideally, I am trying to avoid a really long if
expression.
array('a'=> true, 'b'=> true, ...)
To clarify the expected result:
true
and false
values return nothing.true
values return true
.false
values return false
.if(count(array_unique($your_array)) === 1)
return current($your_array);
else return;