RecursiveArrayIterator
class RecursiveArrayIterator extends ArrayIterator implements RecursiveIterator (View source)
This iterator allows to unset and modify values and keys while iterating over Arrays and Objects in the same way as the ArrayIterator. Additionally it is possible to iterate over the current iterator entry.
Constants
STD_PROP_LIST |
|
ARRAY_AS_PROPS |
|
CHILD_ARRAYS_ONLY |
|
Methods
Construct an ArrayIterator
Returns whether current entry is an array or an object.
Returns an iterator for the current entry if it is an array or an object.
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
bool
hasChildren()
Returns whether current entry is an array or an object.
RecursiveIterator|null
getChildren()
Returns an iterator for the current entry if it is an array or an object.