Possible Duplicate:
Loop an array of array
i was wondering if its possible to iterate over an entire array showing each of the results like this
array:
$input = array("a" => "green", "red", "b" => "green", "blue", "red", "c"=> array("grey",
"black", "yellow", "red" => "something"));
and then have te results like this:
green
red
green
blue
red
grey
black
yellow
something
you could say im looking to show the final value of each array if it happend not to be an array of values itself.
The simplest solution would to do an
array_walk_recursivelike so:Which then outputs:
green red green blue red grey black yellow somethingThis is php 5.4 I believe, older versions of php you need to have the function name as a string and use then create the function
Older PHP versions: