note 31792 added to control-structures
| From: | Storm at rack1 dot php dot net | Date: | Sat, 03 May 2003 22:16:32 +0000 |
| Subject: | note 31792 added to control-structures | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-47479@lists.php.net to get a copy of this message | ||
Although the alternate syntax is nice, I myself prefer to use a simple function:
function iif ($statement,$true_return,$false_return) {
if ($statement == false) {
return $false_return;
} else {
return $true_return;
}
}
Works great for me...
$one = iif (isset($one),$one,'one');
$two = iif (isset($two),$two,'two');
$three = iif (isset($three),$three,'three');
:D
--
http://www.php.net/manual/en/control-structures.php
http://master.php.net/manage/user-notes.php?action=edit+31792
http://master.php.net/manage/user-notes.php?action=delete+31792
http://master.php.net/manage/user-notes.php?action=reject+31792