note 65309 deleted from function.return by bjori
| From: | bjori@php.net | Date: | Fri, 28 Apr 2006 14:28:19 +0000 |
| Subject: | note 65309 deleted from function.return by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-109989@lists.php.net to get a copy of this message | ||
Note Submitter: koromyslo-eto-vesch at yandex dot ru
Reason: in docs
----
Little lollypop about "return" behaviour in
"require_once","include_once" etc.
When you write return construction in included file, like this one:
-- included.php -----
<?
return 2;
?>
-- eof included.php -----
and then include it using "require_once":
-- includer.php -----
<?
echo require_once("included.php") . "\r\n";
echo require_once("included.php") . "\r\n";
?>
-- eof includer.php -----
You will see "2 1".
In other words, require_once call to already included file always returns value "1",
whatever you return from this file.