|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-10-08 12:36 UTC] colder@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 05 00:00:01 2025 UTC |
Description: ------------ Alternative syntax for if has a bug when you do not use brackets Reproduce code: --------------- <? function test($a){ return $a==1?'one':$a==2?'two':$a==3?'three':'more'; } print(test(1).'<br/>'); print(test(2).'<br/>'); print(test(3).'<br/>'); print(test(4).'<br/>'); ?> Expected result: ---------------- one<br/>two<br/>three<br/>more<br/> Actual result: -------------- three<br/>three<br/>three<br/>more<br/>