php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22611 ? : operator precedence is wrong
Submitted: 2003-03-08 13:46 UTC Modified: 2003-03-09 18:29 UTC
From: pts+phpbug at math dot bme dot hu Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.3.1 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
45 + 25 = ?
Subscribe to this entry?

 
 [2003-03-08 13:46 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-09 18:29 UTC] moriyoshi@php.net
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
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 17 17:01:29 2024 UTC