NestedKeyIterator
class NestedKeyIterator extends RecursiveIteratorIterator
Class NestedKeyIterator This iterator iterates recursively through an array, returning as the current key an imploded list of the stacked keys separated by a given separator.
Example:
$ary = [
'foo' => 'bar',
'baz' => ['foo' => ['uh' => 'ah'], 'oh' => 'eh']
]
foreach (new NestedKeyIterator($ary) as $key => $value) {
echo "$key: value\n",
}
prints foo: bar baz.foo.uh: ah baz.oh: eh
Properties
private | $stack | ||
private | $keySeparator |
Methods
__construct(Traversable $iterator, string $separator = '.', int $mode = \RecursiveIteratorIterator::LEAVES_ONLY, int $flags = 0)
No description
callGetChildren()
{@inheritdoc}
endChildren()
{@inheritdoc}
key()
{@inheritdoc}
Details
at line 37
__construct(Traversable $iterator, string $separator = '.', int $mode = \RecursiveIteratorIterator::LEAVES_ONLY, int $flags = 0)
No description
at line 46
callGetChildren()
{@inheritdoc}
at line 56
endChildren()
{@inheritdoc}
at line 65
key()
{@inheritdoc}