note 72429 added to control-structures.break
| From: | php-general at lists dot php dot net | Date: | Thu, 18 Jan 2007 14:12:22 +0000 |
| Subject: | note 72429 added to control-structures.break | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-121883@lists.php.net to get a copy of this message | ||
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').
----
Server IP: 69.147.83.197
Probable Submitter: 84.169.20.132
----
Manual Page -- http://www.php.net/manual/en/control-structures.break.php
Edit -- https://master.php.net/note/edit/72429
Del: integrated -- https://master.php.net/note/delete/72429/integrated
Del: useless -- https://master.php.net/note/delete/72429/useless
Del: bad code -- https://master.php.net/note/delete/72429/bad+code
Del: spam -- https://master.php.net/note/delete/72429/spam
Del: non-english -- https://master.php.net/note/delete/72429/non-english
Del: in docs -- https://master.php.net/note/delete/72429/in+docs
Del: other reasons-- https://master.php.net/note/delete/72429
Reject -- https://master.php.net/note/reject/72429
Search -- https://master.php.net/manage/user-notes.php