note 27005 added to function.unset

From: Date: Wed, 20 Nov 2002 08:59:37 +0000
Subject: note 27005 added to function.unset
Groups: php.notes 
Request: Send a blank email to php-notes+get-39746@lists.php.net to get a copy of this message
I wanted to completly delete an entry from an array and did not find a function for it. So here's the little function i wrote for this purpose: function deleteKey($array, $keyname, $value){ end($array); $last = key($array); $newArray = array(); for($i=0; $i<=$last; $i++){ if($array[$i][$keyname] <> $value){ array_push($newArray, $array[$i]); } } return $newArray; } -- http://www.php.net/manual/en/function.unset.php http://master.php.net/manage/user-notes.php?action=edit+27005 http://master.php.net/manage/user-notes.php?action=delete+27005 http://master.php.net/manage/user-notes.php?action=reject+27005

« previous php.notes (#39746) next »