delete array item and resort
| From: | Mike Krisher | Date: | Wed, 05 Dec 2001 16:31:27 +0000 |
| Subject: | delete array item and resort | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-76738@lists.php.net to get a copy of this message | ||
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
mike@hyperquake.com