Re: Re: PHP 4.0 Bug #5226 Updated: arrayfields reorganized when using array_pop
| From: | Andrei Zmievski | Date: | Tue, 27 Jun 2000 13:56:53 +0000 |
| Subject: | Re: Re: PHP 4.0 Bug #5226 Updated: arrayfields reorganized when using array_pop | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-22478@lists.php.net to get a copy of this message | ||
On Tue, 27 Jun 2000, Stanislav Malyshev wrote:
> I fear it's too generic. Like, you don't build you a new home and destroy
> the old one when you want to throw out garbage :) You don't need to copy
> entire array just to delete last element of it, probably.
When I was writing array_pop(), initially I just did
zend_hash_del()/zend_hash_index_del() on the last element. But something
made me change it and I can't remember what...
> Well, tough question. I'd say to leave all them in place, but then shift
> doesn't work like splice... I'm confused. Any proposals?
I don't think splice() should preserve numeric keys.
-Andrei
"Later in this talk, I intend to define
the universe and give three examples." -- Larry Wall