The ArrayIterator class

(PHP 5, PHP 7, PHP 8)

Giriş

Allows the removal of elements, and the modification of keys or values while iterating over arrays or objects.

To iterate the same array more than once, it is recommended to instantiate ArrayObject and use the ArrayIterator instance either implicitly created when using foreach to iterate over the array stored internally, or create one by calling the ArrayObject::getIterator() method manually.

Sınıf Sözdizimi

class ArrayIterator implements SeekableIterator, ArrayAccess, Serializable, Countable {
/* Sabitler */
public const int STD_PROP_LIST;
public const int ARRAY_AS_PROPS;
/* Yöntemler */
public function __construct(array|object $array = [], int $flags = 0)
public function append(mixed $value): void
public function asort(int $flags = SORT_REGULAR): true
public function count(): int
public function current(): mixed
public function getArrayCopy(): array
public function getFlags(): int
public function key(): string|int|null
public function ksort(int $flags = SORT_REGULAR): true
public function natcasesort(): true
public function natsort(): true
public function next(): void
public function offsetExists(mixed $key): bool
public function offsetGet(mixed $key): mixed
public function offsetSet(mixed $key, mixed $value): void
public function offsetUnset(mixed $key): void
public function rewind(): void
public function seek(int $offset): void
public function serialize(): string
public function setFlags(int $flags): void
public function uasort(callable $callback): true
public function uksort(callable $callback): true
public function unserialize(string $data): void
public function valid(): bool
}

Öntanımlı Sabitler

ArrayIterator Flags

ArrayIterator::STD_PROP_LIST

Properties of the object have their normal functionality when accessed as list (var_dump(), foreach, etc.).

ArrayIterator::ARRAY_AS_PROPS

Entries can be accessed as properties (read and write).

İçindekiler