note 56367 added to function.arrayobject-offsetunset
| From: | primaryspace at hotmail dot com | Date: | Wed, 31 Aug 2005 19:06:07 +0000 |
| Subject: | note 56367 added to function.arrayobject-offsetunset | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-94542@lists.php.net to get a copy of this message | ||
Removes an index from the array object, reducing the number of elements by one and condensing the
list.
<?php
$ao = new ArrayObject(array(1, 2, 3));
foreach($ao->getIterator() as $item) {
if ($item == 2) {
$ao->offsetUnset($ao->getIterator()->current());
}
}
echo $ao->count(); // Prints 2
?>
----
Manual Page -- http://www.php.net/manual/en/function.arrayobject-offsetunset.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+56367
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56367&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56367&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56367&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56367&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56367&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56367&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+56367&report=yes
Search -- http://master.php.net/manage/user-notes.php