Nabi Nabi - 6 months ago 16x
PHP Question

Perform logic operations on boolean array values

I have an array with boolean values, e.g.

$myarray = array(true, false, false, true, false);

Now I want to perform some logic operations on my array values, so I get the output:


from my array.


If you want to get the product of your array, then just use array_product() to multiply each value with each other.

$result = array_product($myarray);

Note that in your array the values TRUE and FALSE just get converted to 1 / 0.