note 39619 added to function.unset
| From: | Moharo at hotmail dot com | Date: | Wed, 04 Feb 2004 22:07:22 +0000 |
| Subject: | note 39619 added to function.unset | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-64653@lists.php.net to get a copy of this message | ||
to use unset() in a loop in order to delete some elements from the array, do the following:
for($i=0,$size=sizeof($array_name);$i<$size;$i++)
{
if($array_name[$i] == 0)
{
//delete elements containing 0
unset($array_name[$i]);
}
}
if unset() is called in a loop, the array length is changed.
----
Manual Page -- http://www.php.net/manual/en/function.unset.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+39619
Delete -- http://master.php.net/manage/user-notes.php?action=delete+39619&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+39619&report=yes
Search -- http://master.php.net/manage/user-notes.php