note 59866 added to function.return
| From: | warhogatwarhogdotnet at osu1 dot php dot net | Date: | Sun, 18 Dec 2005 20:28:44 +0000 |
| Subject: | note 59866 added to function.return | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-100382@lists.php.net to get a copy of this message | ||
for those of you who think that using return in a script is the same as using exit note that: using
return just exits the execution of the current script, exit the whole execution.
look at that example:
a.php
<?php
include("b.php");
echo "a";
?>
b.php
<?php
echo "b";
return;
?>
(executing a.php:) will echo "ba".
whereas (b.php modified):
a.php
<?php
include("b.php");
echo "a";
?>
b.php
<?php
echo "b";
exit;
?>
(executing a.php:) will echo "b".
----
Manual Page -- http://www.php.net/manual/en/function.return.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+59866
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59866&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59866&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59866&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59866&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59866&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59866&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59866&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+59866&report=yes
Search -- http://master.php.net/manage/user-notes.php