Re: Re: PHP 4.0 Bug #5289 Updated: Use of reset on a global array creates local array in function
| From: | Matthew Kendall | Date: | Thu, 29 Jun 2000 21:24:17 +0000 |
| Subject: | Re: Re: PHP 4.0 Bug #5289 Updated: Use of reset on a global array creates local array in function | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-22969@lists.php.net to get a copy of this message | ||
"Alan Frostick" <alan.frostick@iconmedialab.com> wrote ...
> To my mind the fact that a given variable is defined global
> should be retained after using unset, it should merely
> initialise the array to empty but keep it global for further
> references in the function.
If you just want to initialise the array to empty why not do exactly that
with $arr=array() instead of using unset($arr).
After you unset($spoon), it is not that $spoon is now local, it is that
there is no $spoon. You recreate it - as local - when you first use it again
after unset().