note 82676 deleted from control-structures.alternative-syntax by mgf
| From: | mgf@php.net | Date: | Thu, 28 Aug 2008 12:47:38 +0000 |
| Subject: | note 82676 deleted from control-structures.alternative-syntax by mgf | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-143924@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
to martin at rootshell dot cz:
It is called short-circuit evalution same as in C/C++, Javascript, etc.
It is stated here:
http://www.php.net/manual/en/language.operators.logical.php
Another use of this "feature" is like this:
<?php
// Long Version:
if(!empty($_REQUEST["name"])) $name = $_REQUEST["name"];
else $name = "Anonymous";
// Can be written as:
($name = @$_REQUEST["name"]) or ($name = "Anonymous");
?>