Bug #10351: Parsing problem with nested ? : structures
| From: | dwilson at cae dot wisc dot edu | Date: | Mon, 16 Apr 2001 20:14:48 +0000 |
| Subject: | Bug #10351: Parsing problem with nested ? : structures | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-51724@lists.php.net to get a copy of this message | ||
From: dwilson@cae.wisc.edu
Operating system: Sun OS 5.7
PHP version: 4.0.3pl1
PHP Bug Type: Feature/Change Request
Bug description: Parsing problem with nested ? : structures
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 Bug report at: http://bugs.php.net/?id=10351&edit=1