note 72429 deleted from control-structures.break by cmb
| From: | cmb@php.net | Date: | Mon, 05 Nov 2018 16:23:03 +0000 |
| Subject: | note 72429 deleted from control-structures.break by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-209630@lists.php.net to get a copy of this message | ||
Note Submitter:
----
If you wonder how to end execution of a function (as I did), it's that simple: return
function foo($a) {
if(!$a) return;
echo 'true';
// some other code
}
foo(true) will echo 'true', foo(false) won't echo anything (as return ends execution
of the function. Of course, therefore there is no need for 'else' before
'echo').