Re: questions about $_SERVER

From: Date: Mon, 12 Mar 2012 23:12:00 +0000
Subject: Re: questions about $_SERVER
Groups: php.general 
Request: Send a blank email to php-general+get-316999@lists.php.net to get a copy of this message
On 12 Mar 2012 at 20:07, Tedd Sperling <tedd.sperling@gmail.com> wrote: > Tim: > > I read somewhere that using: > > global $x; > > is not recommended. Whereas, it is recommended to use: > > $x = $GLOBALS['x']; > echo $x; Tedd, That may well be, although as I write I can't recollect having seen that anywhere; so I don't use that form. However I have been caught by something like the following: <?php function yes ($a) { global $x; if ($a) $x = "yes\n"; } first (true); echo $x; ?> but I haven't looked into $GLOBALS enough to know whether using them instead would have saved my bacon. -- Cheers -- Tim

« previous php.general (#316999) next »