note 82676 added to control-structures.alternative-syntax
| From: | Anonymous at osu1 dot php dot net | Date: | Mon, 21 Apr 2008 16:59:03 +0000 |
| Subject: | note 82676 added to control-structures.alternative-syntax | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-138618@lists.php.net to get a copy of this message | ||
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");
?>
----
Server IP: 69.147.83.197
Probable Submitter: 121.97.80.26
----
Manual Page -- http://www.php.net/manual/en/control-structures.alternative-syntax.php
Edit -- https://master.php.net/note/edit/82676
Del: integrated -- https://master.php.net/note/delete/82676/integrated
Del: useless -- https://master.php.net/note/delete/82676/useless
Del: bad code -- https://master.php.net/note/delete/82676/bad+code
Del: spam -- https://master.php.net/note/delete/82676/spam
Del: non-english -- https://master.php.net/note/delete/82676/non-english
Del: in docs -- https://master.php.net/note/delete/82676/in+docs
Del: other reasons-- https://master.php.net/note/delete/82676
Reject -- https://master.php.net/note/reject/82676
Search -- https://master.php.net/manage/user-notes.php