* Thus wrote Ford, Mike               [LSS] ([EMAIL PROTECTED]):
> > -----Original Message-----
rints 0, not 1
> > 
> > function setglobal(&$one)
> > {
> >       global $globalvariable;
> 
> PHP actually handles this by executing the equivalent of:
> 
>     $globalvariable = &$GLOBALS['globalvariable'];
> 
> -- that is, it creates a $globalvariable *which is local to the function*
> and makes it be a reference to the global-scope variable of the same name.
> 
> >       $globalvariable =& $one;

Thus getting around the referenced global var, you can access
the global directly:

  $GLOBALS['globalvariable'] = &$one;

Tested:
http://zirzow.dyndns.org/html/php/tests/misc/global_reference.php


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to