#22611 [Opn->Bgs]: ? : operator precedence is wrong
| From: | moriyoshi@php.net | Date: | Mon, 10 Mar 2003 00:29:45 +0000 |
| Subject: | #22611 [Opn->Bgs]: ? : operator precedence is wrong | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-35156@lists.php.net to get a copy of this message | ||
ID: 22611
Updated by: moriyoshi@php.net
Reported By: pts+phpbug at math dot bme dot hu
-Status: Open
+Status: Bogus
Bug Type: Zend Engine 2 problem
Operating System: Linux
PHP Version: 4.3.1
New Comment:
This looks really weird, but it's by design. In PHP "?" have left
associativity in contrast to other languages such as perl in which they
have right associativity.
See also
http://www.php.net/manual/en/language.operators.php
http://www.perldoc.com/perl5.8.0/pod/perlop.html
Previous Comments:
------------------------------------------------------------------------
[2003-03-08 13:46:47] pts+phpbug at math dot bme dot hu
<?php echo 1 ? 2 : 3 ? 4 : 5;
# ^^^ should echo
2', but echoes 4' in PHP 4.3.1
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=22611&edit=1