[PHP] Re: Question on if() priorities

2008-12-12 Thread Maciek Sokolewicz

Frank Stanovcak wrote:
I can't seem to find a reference to this in the manual, but is there an 
order of precedence for and or xor in an if statement?  Kind of like PPMDAS 
or polish notation for math (PPMDAS = Powers. Parenthacies. 
Multiplication...)


I ask because this seems to be working for me, but I want to make sure it is 
doing what I think it is.


(code follows)
if((($FILTERED['cod1'] == 0) or ($FILTERED['cod1'] == 1)) and 
(($FILTERED['cod2'] == 0) or ($FILTERED['cod2'] == 2)) and 
(($FILTERED['cod3'] == 0) or ($FILTERED['cod3'] == 4)))

(end code)

which is if either of the first set, and either of the second set, and 
either of the third set is true return true.


Thanks in advance!
Frank 




http://nl.php.net/manual/en/language.operators.php#language.operators.precedence

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



[PHP] Re: Question on if() priorities

2008-12-12 Thread Frank Stanovcak
Thanks. Don't know how I could have missed that.

Maciek Sokolewicz tula...@php.net wrote in message 
news:49428d51.3090...@php.net...
 Frank Stanovcak wrote:
 I can't seem to find a reference to this in the manual, but is there an 
 order of precedence for and or xor in an if statement?  Kind of like 
 PPMDAS or polish notation for math (PPMDAS = Powers. Parenthacies. 
 Multiplication...)

 I ask because this seems to be working for me, but I want to make sure it 
 is doing what I think it is.

 (code follows)
 if((($FILTERED['cod1'] == 0) or ($FILTERED['cod1'] == 1)) and 
 (($FILTERED['cod2'] == 0) or ($FILTERED['cod2'] == 2)) and 
 (($FILTERED['cod3'] == 0) or ($FILTERED['cod3'] == 4)))
 (end code)

 which is if either of the first set, and either of the second set, and 
 either of the third set is true return true.

 Thanks in advance!
 Frank
 http://nl.php.net/manual/en/language.operators.php#language.operators.precedence
  



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