note 27005 deleted from function.unset by sniper
| From: | sniper@php.net | Date: | Mon, 13 Oct 2003 02:29:01 +0000 |
| Subject: | note 27005 deleted from function.unset by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58489@lists.php.net to get a copy of this message | ||
Note Submitter: oseibert@haba-ag.de
----
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;
}