Re: [PHP4BETA] unset() bug or feature?
| From: | Teodor Cimpoesu | Date: | Mon, 03 Jan 2000 15:40:29 +0000 |
| Subject: | Re: [PHP4BETA] unset() bug or feature? | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-8850@lists.php.net to get a copy of this message | ||
Johan Ekenberg wrote:
>
> Mostly used to Perl, the result of the following code snippet makes me a bit
> confused. I understand PHP makes no difference between arrays and hashes,
> but in this case if feels somewhat awkward. Traversing $array, unsetting
> each value, adding new values, renders an array which doesn't start at index
> 0. Shouldn't unset() really unset the entry, making the internal array
> pointer point to the next free place in $array (i.e. the place of the just
> unset() entry)? In other words, if I unset() $array[0], why doesn't the
> subsequent $array[] = "entry_$i" put "entry_$i" at $array[0]?
As far as I undestood it (from practical code) indexed arrays are just
a particular case for hashes/dictionaries/associative_arrays where the
keys
are an ints.
<snip>
--
CIMPOESU Teodor, Web Programmer
@ DIGICOM S.A. Bucharest, Romania
@ Internet, site development
@ teo@digiro.net , +(401)-330.47.28
official home page ~ http://www.digiro.net/
Internet web page ~ http://internet.digiro.net/