note 33832 added to language.variables.scope
| From: | ppo at beeznest dot net | Date: | Tue, 08 Jul 2003 23:59:21 +0000 |
| Subject: | note 33832 added to language.variables.scope | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-51737@lists.php.net to get a copy of this message | ||
Even if an included file return a value using return(), it's still sharing the same scope as
the caller script!
<?php
$foo = 'aaa';
$bar = include('include.php');
echo($foo.' / '.$bar);
?>
where include.php is
<?php
$foo = 'bbb';
return $foo;
?>
The output is: bbb / bbb
Not: aaa / bbb
----
Manual Page -- http://www.php.net/manual/en/language.variables.scope.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33832
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33832&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33832&report=yes