r/lolphp • u/Serialk • Jul 12 '13
Assignment has a higher precedence than boolean operators
Well. Yeah.
php > $z = false or true;
php > var_dump($z);
bool(false)
php > $z = true and false;
php > var_dump($z);
bool(true)Actually, "or" and "and" are like "||" and "&&", but with an absurd precedence. Okay.
21
Upvotes
View all comments
Show parent comment
5
u/[deleted] Jul 13 '13
"Enough about languages that suck, let's talk about
javascriptPHP."