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
Return current array key
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(TValue>|object $array = [], int $flags = 0, $iterator_class = null)
Construct an ArrayIterator
bool
offsetExists(TKey $key)
Check if offset exists
TValue
offsetGet(TKey $key)
Get value for an offset
void
offsetSet(TKey $key, TValue $value)
Set value for an offset
void
offsetUnset(TKey $key)
Unset value for an offset
void
append(TValue $value)
Append an element
TValue>
getArrayCopy()
Get array copy
int<0, max>
count()
Count elements
int
getFlags()
Get flags
void
setFlags(int $flags)
Set behaviour flags
asort(int $flags = SORT_REGULAR)
Sort array by values
ksort(int $flags = SORT_REGULAR)
Sort array by keys
uasort(TValue): int $callback)
User defined sort
uksort(TKey): int $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
TValue
current()
Return current array entry
TKey|null
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
__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.