$data = [
'title' => 'how to work with iterators',
'posts' => [
[
'title' => 'introduction to iterators',
'email' => '
[email protected]',
],
[
'title' => 'extending iterators',
'email' => '
[email protected]',
],
],
];
$it = new RecursiveIteratorIterator(
new RecursiveArrayIterator($data)
);
foreach($it as $field => $val) {
echo "{$field}:{$val}\n";
}
Sub Title
Recursive*Iterator
Recursively Iterate Array
title: how to work with iterators
title: introduction to iterators
email:
[email protected]
title: extending iterators
email:
[email protected]