Guest User

Untitled

a guest
May 25th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. <?php
  2.  
  3. $a = array(
  4. 'foo',
  5. 'bar',
  6. array('baz', 'qux'),
  7. 'one',
  8. 'two',
  9. array('three'),
  10. 'four',
  11. );
  12.  
  13. $ri = new RecursiveIteratorIterator(new RecursiveArrayIterator($a));
  14.  
  15. var_dump(iterator_to_array($ri, false));
  16.  
  17. /**
  18. array(8) {
  19. [0]=>
  20. string(3) "foo"
  21. [1]=>
  22. string(3) "bar"
  23. [2]=>
  24. string(3) "baz"
  25. [3]=>
  26. string(3) "qux"
  27. [4]=>
  28. string(3) "one"
  29. [5]=>
  30. string(3) "two"
  31. [6]=>
  32. string(5) "three"
  33. [7]=>
  34. string(4) "four"
  35. }
  36. */
Add Comment
Please, Sign In to add comment