note 51932 deleted from function.array-splice by felipe
| From: | felipe@php.net | Date: | Sat, 05 Jan 2008 02:08:58 +0000 |
| Subject: | note 51932 deleted from function.array-splice by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-134820@lists.php.net to get a copy of this message | ||
Note Submitter: fontajos at phpeppershop dot com
----
<?php
// This function deletes a element in an array, by giving it the name of a key.
function delArrayElementByKey($array_with_elements, $key_name) {
$key_index = array_keys(array_keys($array_with_elements), $key_name);
if (count($key_index) != '') {
// Es gibt dieses Element (mindestens einmal) in diesem Array, wir loeschen es:
array_splice($array_with_elements, $key_index[0], 1);
}
return $array_with_elements;
}// End function delArrayElementByKey
?>