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
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 — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
16 - 14 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 20:01:28 2024 UTC