I have the following structure and I dont know how to map it(i dont know if "map" is really what i need also :S)
var -> child1 -> subchild1
-> subchild2 -> subsubchild1
-> child2 -> subchild3
so, I need to map/parse it to something like this:
var.child1.subchild1
var.child1.subchild2.subsubchild1
var.child2.subchild1
I manage to do it up to the 2nd level:
var.child1.subchild1
var.child1.subchild2
This is the code
function foo($a,$txt) {
if (isset($a['childs'])) {
foreach ($a['childs'] as $ch) {
$txt .= foo($ch,$txt);
}
} else {
$txt .= ".".$a['name'];
}
return $txt;
}
foreach ($arr as $childs) {
$aux = $r;
var_dump(foo($childs,$aux));
echo "<br>";
}
Do you have any ideas?
Thanks!