note 79918 added to language.variables.scope
| From: | jistanidiot at gmail dot com | Date: | Wed, 19 Dec 2007 18:42:23 +0000 |
| Subject: | note 79918 added to language.variables.scope | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-133787@lists.php.net to get a copy of this message | ||
Beware the problem that davo971 AT gmail DOT NO DAMN SPAM COM demonstrates can also happen in the
following case:
index.php
<?php
include("test.inc");
?>
test.inc
<?php
function foo() {
global $bar;
echo $bar;
}
$bar = "Hello World";
foo();
?>
This prints nothing.
if you add global $bar at the start of test.inc it will work just fine.
----
Server IP: 208.69.120.35
Probable Submitter: 206.158.182.53
----
Manual Page -- http://www.php.net/manual/en/language.variables.scope.php
Edit -- https://master.php.net/note/edit/79918
Del: integrated -- https://master.php.net/note/delete/79918/integrated
Del: useless -- https://master.php.net/note/delete/79918/useless
Del: bad code -- https://master.php.net/note/delete/79918/bad+code
Del: spam -- https://master.php.net/note/delete/79918/spam
Del: non-english -- https://master.php.net/note/delete/79918/non-english
Del: in docs -- https://master.php.net/note/delete/79918/in+docs
Del: other reasons-- https://master.php.net/note/delete/79918
Reject -- https://master.php.net/note/reject/79918
Search -- https://master.php.net/manage/user-notes.php