Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $a = array(
- 'foo',
- 'bar',
- array('baz', 'qux'),
- 'one',
- 'two',
- array('three'),
- 'four',
- );
- $ri = new RecursiveIteratorIterator(new RecursiveArrayIterator($a));
- var_dump(iterator_to_array($ri, false));
- /**
- array(8) {
- [0]=>
- string(3) "foo"
- [1]=>
- string(3) "bar"
- [2]=>
- string(3) "baz"
- [3]=>
- string(3) "qux"
- [4]=>
- string(3) "one"
- [5]=>
- string(3) "two"
- [6]=>
- string(5) "three"
- [7]=>
- string(4) "four"
- }
- */
Add Comment
Please, Sign In to add comment