note 25513 deleted from ref.array by sniper
| From: | sniper@php.net | Date: | Sat, 18 Oct 2003 18:03:40 +0000 |
| Subject: | note 25513 deleted from ref.array by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58838@lists.php.net to get a copy of this message | ||
Note Submitter: contact at chezjulien . com
----
If you want to delete a value from an array, here's a function which will suit your needs:
<pre>
function array_delete_value($array, $value) {
for($i=0;$i<count($array);$i++) {
if ($array[$i] == $value) unset($array[$i]);
if(!isset($array[$i])) {
$array[$i] = $array[$i+1];
unset($array[$i+1]);
}
}
return $array;
}
</pre>
Hope this helps,
Julien, from France