Let's say you have a multidimensional array like so and assume it won:
$Call = array(
"Foo1" => array(
"Bar1" => array(
"Baz1",
"Baz2"
)
),
"Foo2",
"Foo3" => array(
"Bar2",
"Bar3"
)
);
How would you echo Every Foo, Bar and Baz in the array? I'm particularly having an issue due to Foo2 being set key of 0, so I need to somehow workaround the key being set on values that are not keys.
My current solution, although works, feels too cheat and was wondering if there's cleaner way to loop through the array:
foreach ($Call as $key => $value) {
echo "1.".(is_array($value) ? $key : $value)."<br>";
if(is_array($value)){
foreach ($value as $key => $value) {
echo "a.".(is_array($value) ? $key : $value)."<br>";
if(is_array($value)){
foreach ($value as $key => $value) {
echo "A.".(is_array($value) ? $key : $value)."<br>";
}
}
}
}
}