Re: Inserting into the middle of an array
| From: | Lindsay Adams | Date: | Sun, 01 Apr 2001 19:10:30 +0000 |
| Subject: | Re: Inserting into the middle of an array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-46520@lists.php.net to get a copy of this message | ||
On 4/1/01 11:57 AM, "Yoshi Melrose" <webmaster@validus.com> wrote:
> ----- Original Message -----
> From: "Lindsay Adams" <lindsay@dingos.net>
>> On 4/1/01 11:32 AM, "Yoshi Melrose" <webmaster@validus.com> wrote:
>>
>>> Ok. I must be soooo blind. Is there a function to insert a value into
> the
>>> middle of an array without rewriting it?
>>>
>>>
>> In PHP3, no.
>> PHP4, see http://www.php.net/manual/en/function.array.php
>>
>> You could pull it off with combinations of array_slice, array_splice,
>> array_merge, array_push...
>>
>> Lots of array functions in php4.
>>
>
> Okay. that's what I was afraid of. I was kinda hoping for an array_insert()
> function. =)
>
>
>
Hmm, just looked at the phpclasses website that is listed at the bottom of
Manuel Lemos' posts, and found this:
http://phpclasses.UpperDesign.com/browse.html/package/109
It is a php class that allows you to insert data into any position.
That will take some of the work off your shoulders :)