Re: Quick array question
| From: | David Yee | Date: | Tue, 30 Oct 2001 19:33:10 +0000 |
| Subject: | Re: Quick array question | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-72915@lists.php.net to get a copy of this message | ||
Well for that example I'm using 0 as the index for the first element of the
array, so deleting element #2 results in 3 being deleted. BTW to correct
myself in the second example I gave I want:
$a = (1,2,4,5) instead of (1,2,3,4).
> $a = array(1,2,3,4,5)
>
> unset($a[2]);
>
> $a now = (1, 2, NULL, 4, 5), but I want (1, 2, 3, 4).
Thanks.
David
----- Original Message -----
From: "Sam Masiello" <smasiello@synacor.com>
To: "David Yee" <david@coolcomputing.com>
Sent: Tuesday, October 30, 2001 10:53 AM
Subject: Re: [PHP] Quick array question
>
> Very interesting delete function......
>
> I assume $b should have values (1,3,4,5), not (1,2,4,5) :)
>
> --Sam
>
>
>
> ----- Original Message -----
> From: "David Yee" <david@coolcomputing.com>
> To: <php-general@lists.php.net>
> Sent: Tuesday, October 30, 2001 2:03 PM
> Subject: [PHP] Quick array question
>
>
> Hi. Is there an array function that deletes an array element (that's not
at
> the beginning or the end of the array) and return the resultant array?
E.g.
> this is what I want to do:
>
> $a = array(1, 2, 3, 4, 5);
>
> $b = array_element_delete_function($a, 2);
>
> $b now has 4 elements with the following values: (1, 2, 4, 5)
>
> Thanks.
>
> David
>
>
>