A serious bug? "or" operator gives out diffferent results depending on order of operands

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Here's a little test script:

--------------------
$x = 2;
$y = 10;

$b1 = is_null($x) or ($y > 5);
$b2 = ($y > 5) or is_null($x);

var_dump($b1);
var_dump($b2);
--------------------

Obviously, it should be false for both $b1 and $b2, but the output is:

bool(false)
bool(true)

Is this a bug? I tried dumping values of two expressions, they are both
boolean and correct value. Tried assigning values to two temp vars and
then or-ing these two, and that gave correct results.

I really cannot see what am I doing wrong. Tried this with php 4.3.2 and
4.3.9, and I get these weird results both times.
Maybe I should herd cattle or something :)

Boban.




-- Please reply to the list and not to my email directly. I use usenet server and do not check yahoo email account.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux