I think what Jose is trying to say, is that because 'or' has a lower precidence than =, you are interpreting the expression wrong.
$b1 = is_null($x) or ($y > 5); is the same as ($b1 = is_null($x)) or ($y > 5) This assigns the value of is_null($x) to $b1, regardless of the result of ($y > 5). It's shorthand for if( !($b1 = is_null($x)) ){ ($y > 5); } similarly $b2 = ($y > 5) or is_null($x); assigns $b2 to ($y > 5), or in this case true(since $y == 10). If ($y > 5) returned false, ie if $i <= 5, then it would call the function is_null($x). In this case calling the function is_null() is pointless, since you aren't using the result. What I think you are looking for is either $b2 = (($y > 5) or is_null($x)); // whole thing right of = enclosed in brackets or $b2 = ($y > 5) || is_null($x); // '||' has higher precidence than 'or' On Fri, 24 Dec 2004 16:47:42 -0300, Jose M.Herrera <[EMAIL PROTECTED]> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Bogdan Ribic wrote: > | Here's a little test script: > | > | -------------------- > | $x = 2; > | $y = 10; > | > | $b1 = is_null($x) or ($y > 5); > | $b2 = ($y > 5) or is_null($x); > > Yes, of course. > Your code or example, is just like: > > ( $b1 = is_null($x) ) or ( $y > 5 ) ; > ( $b2 = ($y > 5) ) or is_null($x) ; > > The ">" has more precedence than "=", "or" it has a very low precedence. > Then, $b1 = false and $b2 = True... that's ok! :P > > You example, must have been: > > $b1 = ( ( is_null($x) ) or ( $y > 5 ) ); > $b2 = ( ( $y > 5 ) or ( is_null($x) ) ); > > I this example the value of $b1 is all between the parenthesis (explicitly). > > Bye! > > - -- > Jose Miguel Herrera M. - User #246070 counter.li.org > Est.Ing.Civil Informatica - UTFSM > Valparaiso, Chile - http://www.inf.utfsm.cl/~jherrera > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.2.4 (GNU/Linux) > Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org > > iD8DBQFBzHJdl/j2VHFHn8wRArZdAKCJbv8W54vlpeinK1hMF3xEttjuiACeIIUs > 63OX2bn+h9zLUDHhSvSTr/M= > =3vfi > -----END PGP SIGNATURE----- > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php