Skip to content

Instantly share code, notes, and snippets.

@ephrin
Last active August 29, 2015 14:18
Show Gist options
  • Save ephrin/a172a10dcd3cbe72b0d3 to your computer and use it in GitHub Desktop.
Save ephrin/a172a10dcd3cbe72b0d3 to your computer and use it in GitHub Desktop.
[PHP] "&&" vs "and"
<?php
$e = 0;
$a = null;
function justAmps($e, $a){
if($a = 5 && $e + $a){
print "+";
} else {
print "-";
}
}
function justAnd($e, $a){
if($a = 5 and $e + $a){
print "+";
} else {
print "-";
}
}
justAmps($e, $a); // -
justAnd($e, $a); // +
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment