Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
Bitwise &= for multiple boolean checks
function op($d){
return $d;
$ok = true;
$ok &= op(true);
$ok &= op(true);
$ok &= op(true);
var_dump((bool)$ok); // yields true because all op()s are true.
// another scenario
$ok = true;
$ok &= op(true);
$ok &= op(false);
$ok &= op(true);
var_dump((bool)$ok); // yields false because one of the op()s is false.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.