Re: How to remove a variable from an array
| From: | David Otton | Date: | Mon, 03 Nov 2003 02:11:54 +0000 |
| Subject: | Re: How to remove a variable from an array | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-168367@lists.php.net to get a copy of this message | ||
>>I have tried basically copying and pasting this, and adding a foreach
>>loop. Inside this foreach loop, the array is split apart and I tried
>>using unnset, but I couldn't get it to work, so I deleted the code.
>
>unset ($array[$index])
>
>http://uk.php.net/unset
There are examples in the manual, but as you've already tried unset, I guess
I should be explicit:
<?
$a = array ('a', 'b', 'c', 'd', 'e');
print_r ($a);
unset ($a[2]);
print_r ($a);
?>