note 21283 rejected from language.expressions by sander
| From: | sander@php.net | Date: | Mon, 06 May 2002 18:35:44 +0000 |
| Subject: | note 21283 rejected from language.expressions by sander | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-30269@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"