note 36873 added to language.variables.scope
| From: | php at N_0_SPAN_repenters dot net | Date: | Sat, 25 Oct 2003 18:14:00 +0000 |
| Subject: | note 36873 added to language.variables.scope | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-59285@lists.php.net to get a copy of this message | ||
Folks,
I'm a bit of a newbie, and trying to understand something...
I'm using 4.3.2 with register globals off.
I never declare a variable as global via the keyword 'global'.
When I print_r($GLOBALS), I get a list of all the variables which have been declared in the current
script.
When I process this snippet of code:
$text1 = "Here's my text!";
function global_check() {
$text2 = $GLOBALS['text1'];
return $text2;
}
$throughput = global_check();
Echo "THROUGHPUT is $throughput<BR>";
The result is:
THROUGHPUT is Here's my text!
===================================
I don't understand how $text1 got into the $GLOBALS array, with register_globals off in php.ini
and confirmed with phpinfo.php display.
++++++++++++++++++++++++++++++++++++
When I submit a form using POST, the var is not available without first pulling it out of one of the
superglobals.
-----------------------------------------------
Can someone help me get the concept? THANKS!
----
Manual Page -- http://www.php.net/manual/en/language.variables.scope.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+36873
Delete -- http://master.php.net/manage/user-notes.php?action=delete+36873&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+36873&report=yes
Search -- http://master.php.net/manage/user-notes.php