NYCPHP Meetup

NYPHP.org

[nycphp-talk] Rename an array key?

csnyder chsnyder at gmail.com
Tue Jul 24 15:55:00 EDT 2007


On 7/24/07, Jon Baer <jonbaer at jonbaer.com> wrote:
> All that is really needed is a preserve_key to be added to
> array_splice function and you pretty much have it ...
>
> - Jon

Indeed. When I saw your post I got all excited about doing something like:

array_splice( $set, 3, 1, array('legume'=>'chickpea') );

But as you point out, "keys in replacement array are not preserved."
Not really worthy of the name "splice" in my opinion.



More information about the talk mailing list