ArrayIterator
class ArrayIterator implements SeekableIterator, ArrayAccess, Serializable, Countable (View source)
This iterator allows to unset and modify values and keys while iterating over Arrays and Objects.
Constants
STD_PROP_LIST |
|
ARRAY_AS_PROPS |
|
Methods
Construct an ArrayIterator
Check if offset exists
Get value for an offset
Set value for an offset
Unset value for an offset
Append an element
Get array copy
Count elements
Get flags
Set behaviour flags
Sort array by values
Sort array by keys
User defined sort
User defined sort
Sort an array naturally
Sort an array naturally, case insensitive
Unserialize
Serialize
Rewind array back to the start
Return current array entry
Return current array key
Move to next entry
Check whether array contains more entries
Seek to position
No description
No description
No description
Details
__construct(array $array = [], int $flags = 0, $iterator_class = null)
Construct an ArrayIterator
bool
offsetExists(string $key)
Check if offset exists
mixed
offsetGet(string $key)
Get value for an offset
void
offsetSet(string $key, TValue $value)
Set value for an offset
void
offsetUnset(string $key)
Unset value for an offset
void
append(mixed $value)
Append an element
array
getArrayCopy()
Get array copy
int
count()
Count elements
int
getFlags()
Get flags
void
setFlags(string $flags)
Set behaviour flags
asort(int $flags = SORT_REGULAR)
Sort array by values
ksort(int $flags = SORT_REGULAR)
Sort array by keys
uasort(callable $callback)
User defined sort
uksort(callable $callback)
User defined sort
natsort()
Sort an array naturally
natcasesort()
Sort an array naturally, case insensitive
void
unserialize(string $data)
Unserialize
string|null
serialize()
Serialize
void
rewind()
Rewind array back to the start
mixed
current()
Return current array entry
mixed
key()
Return current array key
void
next()
Move to next entry
bool
valid()
Check whether array contains more entries
void
seek(int $offset)
Seek to position
array
__debugInfo()
No description
array
__serialize()
No description
void
__unserialize(array $data)
No description