note 36873 deleted from language.variables.scope by vincent

From: Date: Sat, 25 Oct 2003 18:50:12 +0000
Subject: note 36873 deleted from language.variables.scope by vincent
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-59286@lists.php.net to get a copy of this message
Note Submitter: php@N_0_SPAN_repenters.net ---- 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!

« previous php.notes (#59286) next »