note 34049 added to control-structures
| From: | rickardsjoquist at hotmail dot com | Date: | Mon, 14 Jul 2003 21:41:00 +0000 |
| Subject: | note 34049 added to control-structures | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-52102@lists.php.net to get a copy of this message | ||
There is an (undocumented? I couldn't find it) way to write simple control structures at one
line (exactly the same as in javascript):
$a = 1;
$b = ($a==1) ? "a is 1" : "a is not 1";
echo $b;
this could also be used this way:
$a = ($a==1) ? true : false;
simple and efficient and easier to read than the regular syntax.
----
Manual Page -- http://www.php.net/manual/en/control-structures.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34049
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34049&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34049&report=yes