Re: PHP 4.0 Bug #5450: unset ain't doing it's job in functions
| From: | Jade Nicoletti | Date: | Fri, 07 Jul 2000 05:56:10 +0000 |
| Subject: | Re: PHP 4.0 Bug #5450: unset ain't doing it's job in functions | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-23773@lists.php.net to get a copy of this message | ||
This is not a but, but a feature.
The local $a is a reference to the global $a, so you're unsetting the
local reference. What you want to do is unset($GLOBALS['a']);
Please close the bug.
-Jade.
On Sat, Jul 08, 2000 at 05:42:24AM -0000, gregory@9voltnet.com wrote:
> From: gregory@9voltnet.com
> Operating system: linux 2.2.14
> PHP version: 4.0.1pl2
> PHP Bug Type: Scripting Engine problem
> Bug description: unset ain't doing it's job in functions
>
> <%
> $a = 'value';
>
> function foo()
> {
> global $a;
>
> unset($a);
> }
>
> function bar()
> {
> global $a;
>
> $a = 0;
> }
>
> print "$a\n";
> print isset($a) . "\n";
>
> foo();
> print "$a\n";
> print isset($a) . "\n";
>
> bar();
> print "$a\n";
> print isset($a) . "\n";
> %>
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
> For additional commands, e-mail: php-dev-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
--
===============================================================================
Jade Nicoletti Nicoletti Net Services Tel. 01 240 4774
Geschäftsleitung Postfach 2519 Fax 01 240 4775
System-Administration 8021 Zürich
============================================[ Weitere Infos: http://nns.ch/ ]==