note 24797 deleted from language.operators by sniper

From: Date: Mon, 13 Oct 2003 00:03:53 +0000
Subject: note 24797 deleted from language.operators by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-58360@lists.php.net to get a copy of this message
Note Submitter: ---- It should be noted that PHP's ?: operator associates left to right. In C and in C++, the ?: operator associates right to left. Thus: 1 ? 2 : 3 ? 4 : 5; has the value 4 in PHP and the value 2 in C and in C++. I find it curious that they would reverse the associativity of an operator from its "accepted" sense, but yet they didn't fix the precedence of the bitwise operators. Thus: if(A & 7 == 5) groups like: if(A & (7 == 5)) It is a trap for the unlucky.

« previous php.notes (#58360) next »