Re: Remove value from array
| From: | Philip Olson | Date: | Mon, 25 Jun 2001 20:02:22 +0000 |
| Subject: | Re: Remove value from array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-55150@lists.php.net to get a copy of this message | ||
Here's an example :
<?php
$foo = array('a','b','c');
unset($foo[1]);
print_r($foo); // [0] => a [2] => c
$bar = array('a','b','c');
$piece = array_splice ($bar, 1 ,1);
print_r($piece); // [0] => b
print_r($bar); // [0] => a [1] => c
?>
http://www.php.net/manual/function.array-splice.php
regards,
philip
On Mon, 25 Jun 2001, Bret R. Zaun wrote:
> Hello,
> how can I complete remove an item out of an array ?
> I tried unset() as well as setting the value to null.
>
> Both result in the value being null but not the item being deleted.
>
> Any help is appreciated
> Heiko
>
>
>
> --
> 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
>