$a = 8; $b = 8;
if( $a && $a > $b ) {
echo "$a greater than $b";
} elseif( $a && $a < $b ) {
echo "$a is less than $b";
} else {
echo "$a is $b";
}
Now for some reason I'm getting "8 is less than 8";
Eh?
First, you may want to pay attention to presedence. && and > have a different order of presedence, on will be done before the other.
And are you sure you want to do && in the first place?
Second, in PHP 4.0.5 it does give '8 is 8'
I've tried adding brackets, so:
if( $a && ( $a > $b ) ) { ... } ... etc
Same result. Using 4.0.4pl1 The $a && part is just some crude checking that $a is non-zero
Time to upgrade I guess...
I'm using 4.0.3pl1 and am getting 8 is 8.
Found the problem, a simple typo.