note 72894 deleted from language.operators.comparison by crell
| From: | crell@php.net | Date: | Wed, 30 Mar 2022 21:48:32 +0000 |
| Subject: | note 72894 deleted from language.operators.comparison by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-217791@lists.php.net to get a copy of this message | ||
Note Submitter: fernandoleal at dragoncs dot com
----
If you need nested ifs on I var its important to group the if so it works.
Example:
<?php
//Dont Works
//Parse error: parse error, unexpected ':'
$var='<option value="1" '.$status == "1" ?
'selected="selected"' :''.'>Value 1</option>';
//Works:
$var='<option value="1" '.($status == "1" ?
'selected="selected"' :'').'>Value 1</option>';
echo $var;
?>