#47004 [Bgs]: Erratic short conditionals
ID: 47004
User updated by: am at webhike dot de
Reported By: am at webhike dot de
Status: Bogus
Bug Type: Scripting Engine problem
Operating System: XAMPP 1.6.8
PHP Version: 5.2.8
New Comment:
Does it make sense to use such confusing left-to-right presence, while
other program languages like Java and C operate from right-to-left?
Previous Comments:
------------------------------------------------------------------------
[2009-01-05 11:10:34] jani@php.net
It's the operator presedence. For more info:
http://www.php.net/manual/en/language.operators.precedence.php
------------------------------------------------------------------------
[2009-01-05 01:02:00] am at webhike dot de
Description:
------------
Using Short Conditionals with more lines is causing wrong results:
Reproduce code:
---------------
$x = 7;
echo
$x == 5 ? 'five' :
$x == 6 ? 'six' :
$x == 7 ? 'seven' :
$x == 8 ? 'eight' :
$x == 9 ? 'nine' :
null;
Actual result:
--------------
Returns 'nine'. Multiline Short Conditionals fail.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47004&edit=1
Thread (3 messages)