Re: delete element from array
| From: | Philip Olson | Date: | Thu, 27 Sep 2001 23:31:58 +0000 |
| Subject: | Re: delete element from array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-69072@lists.php.net to get a copy of this message | ||
unset()
unset($a['key3']);
also, consider array_slice() and array_splice().
regards,
Philip Olson
On Thu, 27 Sep 2001, Alex Shi wrote:
> Hi,
>
> I need to delete a certain element from an array by it's key.
> i.e., I need something like this:
>
> <?
> $a = array( key1=>val1, key2=val2, key3=>val3, key4=>val4 );
> $a = array_delete( $a, 'key3');
> ?>
>
> The function array_delete() is what I need. I want to know if there
> is one built-in for php.
>
> Alex
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>