PHP: ArrayObject::offsetUnset - Manual

downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

CachingIterator::hasNext ArrayObject::offsetSet

Last updated: Fri, 26 Jan 2007

view this page in

# ArrayObject::offsetUnset

(no version information, might be only in CVS)

ArrayObject::offsetUnset -- Unsets the value at the specified $index

## Description

void ArrayObject::offsetUnset ( mixed index )

Внимание
К настоящему времени эта функция еще не была документирована; для ознакомления доступен только список аргументов.

add a note User Contributed Notes
ArrayObject::offsetUnset
primaryspace at hotmail dot com
31-Aug-2005 12:06
`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
?>
---
Note from the extension author:
Try this:
<?php
$ao = new ArrayObject(array(1, 2, 3));
foreach($ao as $key=>$item) { // getIterator() called automatically
if ($item == 2) {
$ao->offsetUnset($key);
}
}
echo $ao->count(); // Prints 2
?>`
add a note
CachingIterator::hasNext ArrayObject::offsetSet

Last updated: Fri, 26 Jan 2007
show source | credits | stats | sitemap | contact | advertising | mirror sites
Copyright © 2001-2007 The PHP Group
All rights reserved.
This mirror generously provided by: Yahoo! Inc.
Last updated: Sat Mar 10 10:36:09 2007 PST