function tree_recurse($id, $indent, $list, $children) { if (@$children[$id]) { foreach ($children[$id] as $v) { $id = $v[0]; $txt = $v[1]; $pt = $v[2]; $list[$id] = "{$indent} {$txt}"; $list = tree_recurse($id, "{$indent}--", $list, $children); } } return $list; }
function tree_recurse($id, $indent, $list, $children) { if (isset($children[$id])) { foreach ($children[$id] as $v) { $id = $v[0]; $txt = $v[1]; $pt = $v[2]; $list[$id] = $indent . ' ' . $txt; $list = tree_recurse($id, $indent . '--', $list, $children); } } return $list; }