note 95865 added to control-structures.if
| From: | gspitzer at free dot fr | Date: | Tue, 26 Jan 2010 19:02:28 +0000 |
| Subject: | note 95865 added to control-structures.if | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-165328@lists.php.net to get a copy of this message | ||
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 ...
----
Server IP: 69.147.83.197
Probable Submitter: 92.143.30.52
----
Manual Page -- http://www.php.net/manual/en/control-structures.if.php
Edit -- https://master.php.net/note/edit/95865
Del: integrated -- https://master.php.net/note/delete/95865/integrated
Del: useless -- https://master.php.net/note/delete/95865/useless
Del: bad code -- https://master.php.net/note/delete/95865/bad+code
Del: spam -- https://master.php.net/note/delete/95865/spam
Del: non-english -- https://master.php.net/note/delete/95865/non-english
Del: in docs -- https://master.php.net/note/delete/95865/in+docs
Del: other reasons-- https://master.php.net/note/delete/95865
Reject -- https://master.php.net/note/reject/95865
Search -- https://master.php.net/manage/user-notes.php