note 40898 deleted from control-structures.alternative-syntax by mgf
| From: | mgf@php.net | Date: | Thu, 28 Aug 2008 12:42:54 +0000 |
| Subject: | note 40898 deleted from control-structures.alternative-syntax by mgf | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-143915@lists.php.net to get a copy of this message | ||
Note Submitter: siebe-tolsma at home dot nl
----
As a rection on sttoo, if you use nested if's a bit different they are less likely to cause
mistakes:
[EDITOR'S NOTE: Referenced Note has been removed]
<?php
$one = true;
$two = true;
$result = ($one ? "one" : ($two ? "two" : "none")); // $result is
"one"
$one = false;
$result = ($one ? "one" : ($two ? "two" : "none")); // $result is
"two"
$two = false;
$result = ($one ? "one" : ($two ? "two" : "none")); // $result is
"none"
?>