0

Possible Duplicate:
How to Flatten a Multidimensional Array?

THe array:

itemA => value
  itemA1 => value
  itemA2 => value
    itemA11 => value
itemB => value

and so on...

How can I get the values gathered like this:

[0] => value (from itemA)
[1] => value (from itemA1)
[2] => value (from itemA2)
[3] => value (from itemA11)
[4] => value (from itemB)
...

?

Community
  • 1
  • 1
user1190692
  • 23
  • 1
  • 2
  • BTW have a look [here](http://davidwalsh.name/flatten-nested-arrays-php) it seems exactly what you need... – digEmAll Feb 05 '12 at 14:30

1 Answers1

4

By writing your own array function, using array_walk() ? Or, i dont know, but maybe with array_values() ?

edit: i found this:

 $a = array(1,2,array(3,4, array(5,6,7), 8), 9); 
 $it = new RecursiveIteratorIterator(new RecursiveArrayIterator($a)); 
 foreach($it as $v) { 
   echo $v, " "; 
 } 
Math
  • 666
  • 8
  • 26