I have an array that I want to use with the the bitwise inclusive or operation.
The two solutions at the moment are:
A foreach() loop that evaluates them in order
$final = 0;
foreach($bits as $bit)
$final = $final | $bit;
}
Imploding the array with the bitwise OR as the glue, and eval() the string
eval(implode(' | ', $bits));
Are these the only options or am I missing a simple native array method?
1in the array. If there is, then the output is1, else0:P$bitsare already exclusive, thenarray_sumwould do.