note 5425 modified in array_splice by ronabop
| From: | ronabop@php.net | Date: | Sun, 03 Sep 2000 09:44:32 +0000 |
| Subject: | note 5425 modified in array_splice by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-4013@lists.php.net to get a copy of this message | ||
Here goes a solution to the problem of being unable to remove an element by key.
<pre>$key_index = array_keys(array_keys($array), $target_key);
array_splice($array, $key_index[0], 1);
</pre>
http://www.php.net/manual/function.array-splice.php