note 83663 added to function.return
| From: | stoic at osu1 dot php dot net | Date: | Fri, 06 Jun 2008 13:21:36 +0000 |
| Subject: | note 83663 added to function.return | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-140178@lists.php.net to get a copy of this message | ||
Just to clear things up, if using return on a global scope it will end EXECUTION but NOT PROCESSING.
for example:
file a.php
<?php
if(defined("A")) return;
define("A", true);
echo "Hello";
?>
file b.php
<?php
include("a.php");
include("a.php");
?>
will output "Hello" only once.
but if file a.php is
<?php
if(defined("A")) return;
define("A", true);
function foo(){
}
?>
running file b.php will produce error:
Fatal Error: Cannot redeclare foo()...
----
Server IP: 69.147.83.197
Probable Submitter: 124.106.46.234
----
Manual Page -- http://www.php.net/manual/en/function.return.php
Edit -- https://master.php.net/note/edit/83663
Del: integrated -- https://master.php.net/note/delete/83663/integrated
Del: useless -- https://master.php.net/note/delete/83663/useless
Del: bad code -- https://master.php.net/note/delete/83663/bad+code
Del: spam -- https://master.php.net/note/delete/83663/spam
Del: non-english -- https://master.php.net/note/delete/83663/non-english
Del: in docs -- https://master.php.net/note/delete/83663/in+docs
Del: other reasons-- https://master.php.net/note/delete/83663
Reject -- https://master.php.net/note/reject/83663
Search -- https://master.php.net/manage/user-notes.php