[PHP] delete array item and resort

2001-12-05 Thread Mike Krisher
what is the easiest way to delete an array element and then resort the array so the elements receive the correct numbering. I was thinking something like this: $itemArray = array(red,blue,yellow); delete($itemArray[1]); so key 0 is still red but key 2 is still yellow but is remembered to

Re: [PHP] delete array item and resort

2001-12-05 Thread Jim
$array = array(a,b,c); print_r($array); unset($array[1]); print_r($array); $array = array_values($array); print_r($array); -- produces Array ( [0] = a [1] = b [2] = c ) Array ( [0] = a [2] = c ) Array ( [0] = a [1] = c ) Jim what is the easiest way to delete an array element and