note 25513 added to ref.array
| From: | contact at rack1 dot php dot net | Date: | Thu, 26 Sep 2002 11:33:50 +0000 |
| Subject: | note 25513 added to ref.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-37275@lists.php.net to get a copy of this message | ||
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
--
http://www.php.net/manual/en/ref.array.php
http://master.php.net/manage/user-notes.php?action=edit+25513
http://master.php.net/manage/user-notes.php?action=delete+25513
http://master.php.net/manage/user-notes.php?action=reject+25513