note 36076 added to function.unset

From: Date: Thu, 25 Sep 2003 01:15:54 +0000
Subject: note 36076 added to function.unset
Groups: php.notes 
Request: Send a blank email to php-notes+get-57075@lists.php.net to get a copy of this message
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 ;) ---- Manual Page -- http://www.php.net/manual/en/function.unset.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+36076 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+36076&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+36076&report=yes

« previous php.notes (#57075) next »