PHP 4.0 Bug #8378 Updated: unsetting a global array
| From: | sniper@php.net | Date: | Thu, 28 Dec 2000 09:28:45 +0000 |
| Subject: | PHP 4.0 Bug #8378 Updated: unsetting a global array | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-42358@lists.php.net to get a copy of this message | ||
ID: 8378
Updated by: sniper
Reported By: superfly@jocose.net
Old-Status: Open
Status: Bogus
Bug Type: Arrays related
Assigned To:
Comments:
This is how it is supposed to work.
Not a bug.
--Jani
Previous Comments:
---------------------------------------------------------------------------
[2000-12-22 13:57:56] superfly@jocose.net
<?
function unsetArray()
{
global $array;
unset($array);
}
$array[0] = "foo";
$array[3] = "bar";
unsetArray();
$array[1] = "new";
$array[2] = "data";
?>
This will set $array up like this:
$array[0] = "";
$array[1] = "new";
$array[2] = "data";
$array[3] = "";
However:
<?
function unsetArray()
{
unset($GLOBALS["array"]);
}
$GLOBALS["array"][0] = "foo";
$GLOBALS["array"][3] = "bar";
unsetArray();
$GLOBALS["array"][1] = "new";
$GLOBALS["array"][2] = "data";
?>
will set up an array like this:
$array[1] = "new";
$array[2] = "data";
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=8378