Page 1 of 1

Empty an array?

Posted: Sat May 15, 2004 4:31 pm
by Matt Phelps
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?!

Posted: Sat May 15, 2004 5:05 pm
by feyd

Code: Select all

//assuming you have a situation like:
$ar = array(1,2,3,4,5,6);
//empty it with:
$ar = array();
:D

Posted: Sun May 16, 2004 6:34 am
by mudkicker
to unset only one value of an array is:

Code: Select all

<?
unset($ar[0]);
?>
just wanted you to know it ;)