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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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: Sun Dec 22 01:01:30 2024 UTC