'1',
'title' => 'Home',
'url' => '/index.php',
array(
'id' => '2',
'title' => 'Products',
'url' => '/products/',
array(
'id' => '4',
'title' => 'Plastic Bags',
'url' => '/products/plastic_bags.php'
),
array(
'id' => '5',
'title' => 'Paper Bags',
'url' => '/products/paper_bags.php'
),
array(
'id' => '6',
'title' => 'Vomit Bags',
'url' => '/products/vomit_bags.php'
)
),
array(
'id' => '3',
'title' => 'Services',
'url' => '/services/',
array(
'id' => '7',
'title' => 'Bag cleaning',
'url' => '/services/cleaning.php'
),
array(
'id' => '8',
'title' => 'Bag disposal',
'url' => '/services/disposal.php'
)
)
);
function printHeir($node, $parent=0, $n=0)
{
if (is_array($node) && !empty($node)) {
echo str_repeat(' ', $n) . $node['title'] . ' => ' . $node['url'] . ' (' . $parent . ',' . $node['id'] . ') ' . '
';
foreach ($node as $key=>$val) {
if (is_array($val) && !empty($val)) {
printHeir($val, $node['id'], $n+1);
}
}
}
}
?>
Formatted array data:
Raw array data: