Empty an array?
Moderator: General Moderators
-
Matt Phelps
- Forum Commoner
- Posts: 82
- Joined: Fri Jun 14, 2002 2:05 pm
Empty an array?
Can't seem to find a function to do this. I want to empty an array completely of all data. I tried unset and empty but neither appear to work. Is there a way to empty an array?!
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Code: Select all
//assuming you have a situation like:
$ar = array(1,2,3,4,5,6);
//empty it with:
$ar = array();- mudkicker
- Forum Contributor
- Posts: 479
- Joined: Wed Jul 09, 2003 6:11 pm
- Location: Istanbul, TR
- Contact:
to unset only one value of an array is:
just wanted you to know it 
Code: Select all
<?
unset($ar[0]);
?>