Can someone explain what's happening here:
if(2 && 5 < 4)
If i've got for example
$x = 2 && 3;
and var_dump($x) it gives boolean(true) no matter what numbers are. But here it looks like numbers are comparing to 4 one by one.
Can someone explain what's happening here:
if(2 && 5 < 4)
If i've got for example
$x = 2 && 3;
and var_dump($x) it gives boolean(true) no matter what numbers are. But here it looks like numbers are comparing to 4 one by one.
Look at the PHP comparison table for PHP http://php.net/manual/en/types.comparisons.php
For integers a number other than 0 returns true in comparison.
if (2 && 5 < 4) => if (true && false) => false
$x = 2 && 3 = 1 && 1 = 1
because if a variable has an integer value, true becomes 1 because of type conversion.