Re: Environment extract

From: Date: Tue, 27 Mar 2001 19:24:04 +0000
Subject: Re: Environment extract
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-45764@lists.php.net to get a copy of this message
Ahh, that's the cause. Here's how to duplicate the error :-) error_reporting(E_NOTICE); foo(); function foo() { echo $HTTP_USER_AGENT; } As Mark mentioned, mind your scope. Regarding the error, I just posted some information on this perhaps it'll be of some use : http://marc.theaimsgroup.com/?l=php-general&m=98571030029538&w=2 Regards, Philip On Tue, 27 Mar 2001, Mark Maggelet wrote: > > On Tue, 27 Mar 2001 17:31:25 +0100, Costas (costas@othermedia.com) > wrote: > >when i try printing > > > >print $HTTP_USER_AGENT; > > > >I get the error message Undefined variable: HTTP_USER_AGENT > > > >have i missed a declaration of some sort or something else? > > > >thanks > > Are you doing this from inside a function? If so you have to make it > global at the top: > > function foo(){ > global $HTTP_USER_AGENT; > echo $HTTP_USER_AGENT; > } > > > > > -- > 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 (#45764) next »