note 36076 deleted from function.unset by sniper
| From: | sniper@php.net | Date: | Mon, 13 Oct 2003 02:28:02 +0000 |
| Subject: | note 36076 deleted from function.unset by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58481@lists.php.net to get a copy of this message | ||
Note Submitter: zitan@mediasculpt.net
----
I recommend that you don't use unset for deleting elements from an array, this creates an
unstable array in my experience. This caused me a headache used in conjunction with array_search
and a loop.
I suggest using array_splice:
<?
array_splice($array, $key, 1);
?>
I can provide more details if anyone is interested ;)