$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 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
>become key 1.
>
>Hopefully that makes sense, get rid of one item in the middle and the rest
>of the array moves up one position.
>Thanks,
>» Michael Krisher
>   [EMAIL PROTECTED]
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


--
Jim Musil
---------
Multimedia Programmer
Nettmedia
-------------
212-629-0004
[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to