note 21283 added to language.expressions

From: Date: Mon, 06 May 2002 18:21:52 +0000
Subject: note 21283 added to language.expressions
Groups: php.notes 
Request: Send a blank email to php-notes+get-30266@lists.php.net to get a copy of this message
As already mentioned by others, notice that a piece of code like the following might not produce the desired output: <?php $mystring = "This should be "; $bool = true; function myfunction($a_string) { echo $a_string."<br>"; } myfunction($mystring.($bool)?"true":"false"); ?> The function myfunction will print only the string "true". Instead, if you put the ($expr?$val_a:$val_b) into round parentesis, it will work: myfunction($mystring.(($bool)?"true":"false")); will print "This should be true" -- http://www.php.net/manual/en/language.expressions.php http://master.php.net/manage/user-notes.php?action=edit+21283 http://master.php.net/manage/user-notes.php?action=delete+21283 http://master.php.net/manage/user-notes.php?action=reject+21283

« previous php.notes (#30266) next »