[Solved] Perform logic operations on boolean array values


You could try this:

$res = true;
foreach ($myarray as $item) $res &= $item;
echo var_dump($res);

A bit less elegant, but it should work. You’ll have an integer in the end because we’re using bit logic here, could be improved.

For a OR case you could do almost the same thing:

$res = true;
foreach ($myarray as $item) $res |= $item;
echo var_dump($res);

0

solved Perform logic operations on boolean array values