Re: Array function to delete
| From: | Lars Torben Wilson | Date: | Fri, 26 Apr 2002 19:46:43 +0000 |
| Subject: | Re: Array function to delete | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-94640@lists.php.net to get a copy of this message | ||
On Thu, 2002-04-25 at 12:34, Nathan wrote:
> No. :-)
>
> What I've had to do is add a dummy value, unset($array[4]) and then array_pop the dummy
> value off
> the array to get it out of there completely. The reason: unset will only remove
> $array[4]'s value,
> not the key.
>
> There are plenty of other ways I'm sure, but simply unsetting has really messed me up on
> occasion.
> I'll unset a value and then implode my array (say a list of numbers), and end up with a
> string like
> so:
>
> 1,233,642,,234,5632,
>
> Where I've unset the 4th and last keys. Which of course really messes up and explode.
>
> # Nathan
You need to upgrade. :) The above hasn't been true for a while...at
least since 4.1.2 and perhaps earlier.
> ----- Original Message -----
> From: "Liam Gibbs" <liamgibbs@yahoo.com>
> To: <php-general@lists.php.net>
> Sent: Thursday, April 25, 2002 1:22 PM
> Subject: [PHP] Array function to delete
>
>
> I've been checking the PHP documentation, but can't
> find a function that will delete a member of an array,
> like such:
>
> $a = array(1, 2, 3, 4, 5);
>
> Use the function, say array_delete($a, 3); and that
> will delete the third member in the array (which would
> be 4 above), so that the array would contain 1, 2, 3,
> 5.
>
> Is there such a function?
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Games - play chess, backgammon, pool and more
> http://games.yahoo.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Torben Wilson <torben@php.net>
http://www.thebuttlesschaps.com
http://www.hybrid17.com
http://www.inflatableeye.com
+1.604.709.0506