On 12 Mar 2012 at 20:07, Tedd Sperling <[email protected]> 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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php