note 39500 deleted from language.references.whatdo by didou
| From: | didou@php.net | Date: | Fri, 30 Jan 2004 16:06:23 +0000 |
| Subject: | note 39500 deleted from language.references.whatdo by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-64445@lists.php.net to get a copy of this message | ||
Note Submitter: stepan at comlinks dot cz
----
I have one warning (spent 3 hours on it) - sample piece of code:
function a()
{
global $glob_var;
$local_var = array();
$glob_var = &$localvar;
$local_var[1] = 2;
$local_var[2] = 3;
print_r ($glob_var);
}
print_r( $glob_var); // no output - empty var
a(); // outputs Array ( [1]=>2 [2]=>3 )
print_r( $glob_var); // !!! no output - empty var ($local_var has been discarded) !!!
My code was a bit more complex and I needed this construct only for better code reading. I dont know
how to make some "temporary reference holder", so finally I had to write everywhere
$glob_var instead of $local_var.
Stepan Liska.