php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #16621 different ?: operator precedence then in C
Submitted: 2002-04-15 10:00 UTC Modified: 2010-12-03 17:52 UTC
Votes:8
Avg. Score:4.6 ± 0.7
Reproduced:8 of 8 (100.0%)
Same Version:3 (37.5%)
Same OS:5 (62.5%)
From: pete at ana dot sk Assigned:
Status: Wont fix Package: *General Issues
PHP Version: 4.1.2 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: pete at ana dot sk
New email:
PHP Version: OS:

 

 [2002-04-15 10:00 UTC] pete at ana dot sk
Maybe its intentional, but i think that it would be best to have some consitence with C.
1 ? "A" : 1 ? "B" : "C"
return "A" in C (since ?: is associated from right to left)
but it returns "B" in  PHP (since its left to right).

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-15 10:28 UTC] pete at ana dot sk
Maybe its intentional, but i think that it would be best to have some
consitence with C.
1 ? "A" : 1 ? "B" : "C"
return "A" in C (since ?: is associated from right to left)
but it returns "B" in  PHP (since its left to right).
 [2010-12-03 17:52 UTC] jani@php.net
-Status: Open +Status: Wont fix -Package: Feature/Change Request +Package: *General Issues
 [2010-12-03 17:52 UTC] jani@php.net
Use parenthesis. PHP != C :)
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC