Re: Bug #3079: Unset() leaves holes in arrays
| From: | Zeev Suraski | Date: | Sat, 01 Jan 2000 16:48:08 +0000 |
| Subject: | Re: Bug #3079: Unset() leaves holes in arrays | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-14188@lists.php.net to get a copy of this message | ||
Won't be fixed in 3.x.
Zeev
On 1 Jan 2000 tobias@dnet.it wrote:
> From: tobias@dnet.it
> Operating system: Suse Linux 6.1
> PHP version: 3.0.13
> PHP Bug Type: Misbehaving function
> Bug description: Unset() leaves holes in arrays
>
> Unset(), when applied to array elements, leaves holes in the array.
>
> Take this code:
> $array = array("a");
> unset($array[0]);
> $array[] = "d";
> var_dump($array);
>
> This will produce the following output with PHP 3.0.12 and 3.0.13:
> array(2) {
> int(1)
> string(1) "d"
> }
>
> a) It would make more sense if the index would be 0.
> b) var_dump() sees the array as containing two elements. Count() works fine, though. PHP
> 4.x's var_dump() shows correctly array(1).
>
>
>
>
--
Zeev Suraski <zeev@zend.com>
http://www.zend.com/