I am struggling with an array I want to turn into a nested < select >
I need:
this just litle change of the original code that answered by Qeremy
function printTree($tree, $r = 0, $p = null) {
foreach ($tree as $i => $t) {
$dash = ($t['parent'] == 0) ? '' : str_repeat('-', $r) .' ';
printf("\t\n", $t['id'], $dash, $t['name']);
if (isset($t['_children'])) {
printTree($t['_children'], $r+1, $t['parent']);
}
}
}
Now the dashed name works great. *sorry for my english