Re: Please help with Array..
| From: | Wee Keat | Date: | Fri, 19 Jul 2002 13:44:37 +0000 |
| Subject: | Re: Please help with Array.. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-108495@lists.php.net to get a copy of this message | ||
Wow!!
That was really speedy...
Thanks again!! Love this mailing list heaps!!!!
Yours,
Wee Keat Chin
---------------------------------------------------
"Man is only truly great when he acts from his passions."
----- Original Message -----
From: "Michael Hall" <olc@openlearningcommunity.org>
To: "Wee Keat" <weekeat@amorphosium.com>
Cc: "PHP General" <php-general@lists.php.net>
Sent: Friday, July 19, 2002 11:43 PM
Subject: Re: [PHP] Please help with Array..
>
> Try array_splice();
>
> Something like this:
>
> $newarray = array_splice($shoppingcart,345,1);
>
> In other words, start at element 345 and remove one element.
>
> Michael
>
>
>
> On Fri, 19 Jul 2002, Wee Keat wrote:
>
> > Hi all how are yas?
> >
> > I have one question for which I could not find the answer:
> >
> > How do I remove an element of an array with a specific key or index?
> >
> > To be clearer:
> >
> > Lets say I have an array $shoppingCart[] (quite a lot of
them)
> > I want to delete $shoppingCart[345] (which is not the last
or the first)
> > How do I do it?
> >
> >
> > I have checked the PHP manual... it has array_pop, array_shift which are
for the last element and the first element. But what about specific elements
in between the first and the last?
> >
> > Please help out... I'm really in a rush to finish my project... :(
> >
> > Thanks soooo much in advance for your time.
> >
> >
> > Yours,
> > Wee Keat Chin
> >
> > ---------------------------------------------------
> >
> > "Man is only truly great when he acts from his passions."
> >