note 95865 deleted from control-structures.if by thiago
| From: | thiago@php.net | Date: | Tue, 26 Jan 2010 19:13:15 +0000 |
| Subject: | note 95865 deleted from control-structures.if by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-165331@lists.php.net to get a copy of this message | ||
Note Submitter: gspitzer at free dot fr
----
As chrislabricole said, you can use
cond ? action_if_true : action_if_false;
An additional information : You can imbrique condition like the next sentence
but don't forget to put parentheses around the nested test or the result could be wrong :
$texte .= ($ar == '') ? '-' : ( ($ar == 'A') ? 'Accepted' :
'Refused' );
^ ^
| |
My 2 cents ...