note 72892 deleted from language.types.string by bjori
| From: | bjori@php.net | Date: | Mon, 05 Feb 2007 07:56:35 +0000 |
| Subject: | note 72892 deleted from language.types.string by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-122869@lists.php.net to get a copy of this message | ||
Note Submitter: fernandoleal at dragoncs dot com
----
If you need nested ifs on a 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;
?>