RE: [PHP] 3rd include

From: Date: Wed, 08 Aug 2001 20:17:44 +0000
Subject: RE: [PHP] 3rd include
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-61903@lists.php.net to get a copy of this message
For reference, in case anyone cares-- from within functions, I usually just do: global $HTTP_POST_VARS; extract($HTTP_POST_VARS); ...to account for the scope of the form vars. -----Original Message----- From: Mark Roedel [mailto:MarkRoedel@letu.edu] Sent: Wednesday, August 08, 2001 4:08 PM To: Drew P. Vogel Cc: php-general@lists.php.net Subject: RE: [PHP] 3rd include > -----Original Message----- > From: Drew P. Vogel [mailto:dvogel@intercarve.net] > Sent: Wednesday, August 08, 2001 3:14 PM > To: Mark Roedel > Cc: php-general@lists.php.net > Subject: RE: [PHP] 3rd include > > > If a file is included from within a function, this would limit the > variable cope of this file, correct? Yes it would. (Specifically, it would mean that everything in that file operates at the same scope as the function in which it's included. That, in turn, means that $HTTP_POST_VARS is likely only available if it's been declared as global within that function. --- Mark Roedel (roedelm@letu.edu) || "There cannot be a crisis next week. Systems Programmer / WebMaster || My schedule is already full." LeTourneau University || -- Henry Kissinger > On Wed, 8 Aug 2001, Mark Roedel wrote: > > >> -----Original Message----- > >> From: Drew P. Vogel [mailto:dvogel@intercarve.net] > >> Sent: Wednesday, August 08, 2001 2:19 PM > >> To: Mark Roedel > >> Cc: php-general@lists.php.net > >> Subject: RE: [PHP] 3rd include > >> > >> > >> You're right. It is not discuessed there. My memory served me > >> incorrectly. > >> > >> In index.php (the file loaded by php), > >> echo( $HTTP_POST_VARS["last_name"] ); > >> will print the variable contents, but in save_script.php (the 3rd > >>file included) the same function call will print nothing. > > > >Are you quite sure there's not something else going on here? > (An issue > >of the $HTTP_POST_VARS array being out-of-scope inside a > function, for > >example?) I'm sure I would have run into this behavior by now if it > >were a system bug. > > > >For whatever it's worth, I just did a test, with includes nested ten > >deep, and $HTTP_POST_VARS kept its value at every level. (PHP 4.0.6, > >Apache 1.3.20, FreeBSD 4-Stable) > > > > > >--- > >Mark Roedel (roedelm@letu.edu) || "There cannot be a > crisis next week. > >Systems Programmer / WebMaster || My schedule is already full." > > LeTourneau University || -- > Henry Kissinger > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#61903) next »