Bug #10351 Updated: Parsing problem with nested ? : structures
| From: | jimw@php.net | Date: | Sat, 27 Apr 2002 19:19:23 +0000 |
| Subject: | Bug #10351 Updated: Parsing problem with nested ? : structures | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-6280@lists.php.net to get a copy of this message | ||
ID: 10351
Updated by: jimw@php.net
Reported By: dwilson@cae.wisc.edu
-Status: Open
+Status: Closed
Bug Type: Feature/Change Request
Operating System: Sun OS 5.7
PHP Version: 4.0.3pl1
New Comment:
it does execute correctly, given the relative precedence of the '<' and
'?:' operators.
Previous Comments:
------------------------------------------------------------------------
[2001-04-16 16:14:48] dwilson@cae.wisc.edu
The following statement does not execute correctly:
$departmeals = $dHour < 10.5 ? $dHour < 6.0 ? "3" : "2"
:
$dHour < 18.0 ? "1" : "0";
No error message--it just returns the wrong result. It does execute
correctly if parentheses are added:
$departmeals = $dHour < 10.5 ? ($dHour < 6.0 ? "3" : "2")
:
($dHour < 18.0 ? "1" : "0");
The original is not ambiguous; it should parse and execute correctly.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=10351&edit=1