Is there any built in functionality in php for emptying an array?
ie zeroing every entry
-Mike
I don't think so, but you can create a function to do that easily:
function emptyArray($arr) { for ($i=0; $i<count($arr); $i++) { $arr[$i] = 0; } }
Or, just use
$arr = array(6); $arr = array_fill(0, count($arr), 0);
Diego
Or, depending on context, just reset your array to an empty one.
$arr = array();