Re: Re: reindexing an array after unset()
| From: | Daniel Grace | Date: | Sat, 18 May 2002 22:31:11 +0000 |
| Subject: | Re: Re: reindexing an array after unset() | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-98299@lists.php.net to get a copy of this message | ||
"Erik Price" <pricee@hhbrown.com> wrote in message
news:5BDF1D92-62BB-11D6-8E8E-0050E4857868@hhbrown.com...
>
> On Wednesday, May 8, 2002, at 03:28 PM, Kyle Gibson wrote:
>
> >> What do you think?
> >
> > Try
> >
> > array_pop($array);
> >
>
> array_pop() is perfect, except that I don't want to take the last
> element off the end. Otherwise I would definitely use it.
>
> Erik
>
$array = array_values($array) will re-index your array without the need for
array_pop and array_push.
-- Daniel Grace