Re: Re: PHP 4.0 Bug #5226 Updated: arrayfields reorganized when using array_pop

From: Date: Wed, 02 Aug 2000 13:22:35 +0000
Subject: Re: Re: PHP 4.0 Bug #5226 Updated: arrayfields reorganized when using array_pop
References: 1 2 3  Groups: php.dev 
Request: Send a blank email to php-dev+get-27441@lists.php.net to get a copy of this message
On Tue, Jun 27, 2000 at 09:16:10AM -0500, Andrei Zmievski wrote: > On Tue, 27 Jun 2000, Stanislav Malyshev wrote: > > Yeah. So we should put on all splice-derived functions big red sign "It > > wuld mess with all keys that look like numerics". I do not see what else > > can we do now about it. > > Yes, and that's another reason to keep array_pop() using php_splice() - > otherwise, like you pointed out, array_pop($a) array_splice($a, -1) > would be inconsistent. So what? Then you can use the one that suits your needs. I would like array_pop to change, it would make it quicker too. As I said earlier when this came up, I think you can add an additional internal array_splice function that can be used for array_pop, and perhaps have an extra parameter to array_splice whether it should touch the keys. Then you could use different internal array_splice depending on whether to touch the keys. Maybe the internal array_splice might do both, but might be easier to have two functions I think. My main point is that you can still do things in a generic way, and it might be good to be able to choose whether to preserve keys when splicing. Stig

« previous php.dev (#27441) next »