- iPhone (2)
- Learning (42)
- Linux (4)
- Debian (1)
- Mac Terminal / Linux (5)
- Other Stuff (1)
- Programming (66)
- Slim Framework (1)
- Uncategorized (4)
- WordPress (5)
We participate in the Amazon Service LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
$x = true and false; var_dump($x);
This one is interesting. In PHP, you can use
and to do a logical comparison.
However, due to the Operator Precedence rules,
and actually has lower precedence than
&& has higher!
That means that the value of $x will be true.
Two ways to fix this:
$x = (true and false); // evaluates to false
$x = true && false; // evaluates to false