Can I use if(4 <= $a <= 44)
instead of if(4 <= $a && $a <= 44)
?
views:
293answers:
4
+4
A:
No, you can't.
if(4 <= $a <= 44)
will (I believe) be parsed as if ((4 <= $a) <= 44)
, which checks whether (4 <= $a)
(which is either 0 or 1) is less than 44.
SLaks
2010-05-06 22:08:59
+8
A:
No, you can't do that.
if(4 <= $a <= 44)
is equivalent to if((4 <= $a) <= 44)
. This may be equivalent to if(false <= 44)
or if(true <= 44)
, neither of which makes sense.
Svisstack
2010-05-06 22:09:21