note 16541 added to control-structures.alternative-syntax
| From: | juxstapose at home dot com | Date: | Sat, 03 Nov 2001 13:00:41 +0000 |
| Subject: | note 16541 added to control-structures.alternative-syntax | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-20359@lists.php.net to get a copy of this message | ||
For testing a variable with only 2 possible control path values here is one line syntax,
($test) ? $result = "something" : $result ="nothing";
which is the same as
if ($test)
$result = "something
--
http://www.php.net/manual/en/control-structures.alternative-syntax.php
http://master.php.net/manage/user-notes.php?action=edit+16541
http://master.php.net/manage/user-notes.php?action=delete+16541
http://master.php.net/manage/user-notes.php?action=reject+16541