note 35755 added to function.unset
| From: | Amon-Jack at csa-corp dot com | Date: | Sat, 13 Sep 2003 07:09:39 +0000 |
| Subject: | note 35755 added to function.unset | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-56424@lists.php.net to get a copy of this message | ||
[QUOTE]
function deleteKey($array, $keyname, $value)
{
end($array);
$last = key($array);
for($i=0; $i<=$last; $i++)
{
if($array[$i][$keyname] == $value)
{
unset($array[$i]);
}
}
$newArray = array_values( $array );
return $newArray;
}
[/QUOTE]
Why working so complex?
unset($array[$keyname]) is still the same.
----
Manual Page -- http://www.php.net/manual/en/function.unset.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35755
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35755&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35755&report=yes