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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: pts+phpbug at math dot bme dot hu
New email:
PHP Version: OS:

 

 [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 May 27 08:01:33 2024 UTC