okay, i assume you mean you have an array like this:
$foo[0] = "cat"
$foo[1] = "dog"
$foo[2] = "guppy"
$foo[3] = "paramecium"
and you want to "remove" $foo[2] so that your array looks like:
$foo[0] = "cat"
$foo[1] = "dog"
$foo[2] = "paramecium"
ie, it is "repacked". if that is so then what you really want is a vector, not an array... but php doesn't do vectors (to my knowledge at least).
this func takes the array you have and an array of all the indexes you want to remove (ie if you want to remove indexes 3, 9 and 21 from the array, then those three numbers would be stored in $array_of_indexes_to_remove). it returns a new packed array.
note: i just wrote this off the top of my head with zero testing so there's a good chance it just won't work... but the idea is the important thing here... 🙂
function vector_remove($the_vector, $array_of_indexes_to_remove)
{
....for($i=0;$i<count($the_vector);$i++)
....{
........for($j=0;$j<count($array_of_indexes_to_remove);$j++)
........{
............if($array_of_indexes_to_remove[$j] == $i)
............{
................$i++;
................break;
............}
........}
........$new_vector[] = $the_vector[$i];
....}
....return $new_vector;
}
-frymaster