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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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 Jun 17 17:01:29 2024 UTC