I am able to currently take a multi-dimensional array and show all of it's elements, but with each additional dimension, I have to add code to support it.
I want to find a way to be able to throw an array with any amount of dimensions at a function and have it display the contents
Here is what I'm doing for an array with 3 dimensions:
<?
$ar = array("one" => array("a", "b", "c"), "two" => array("d", "e", "f" => array("ef", "foot", "arm"), "g", "h"), "three");
foreach($ar_un_srlz as $k => $v)
{
if (!is_array($v))
{
echo "$v \n";
}
else
{
echo "$k: ";
foreach($v as $z => $s)
{
if (!is_array($s))
{
echo "$s \n";
}
else
{
echo "$z (\n";
foreach ($s as $q)
{
echo "$q, \n";
}
echo ")\n";
}
}
}
echo "<br>\n";
}
?>
this is the output:
one: a b c
two: d e f ( ef, foot, arm, ) g h
three
any ideas?
thanks,
-=Lazzerous=-