<?php
$map = Array
(
0 => "test.txt",
'two' => Array
(
0 => "test.txt",
'testing' => Array
(
0 => "testagain.txt"
)
),
"three" => Array
(
0 => "testthree.txt"
),
1 => "test.txt",
"one" => Array
(
0 => "testone.txt",
"subone" => Array
(
0 => "testsubone.txt"
)
)
);
function print_dir($in,$depth)
{
foreach ($in as $k => $v)
{
if (!is_array($v))
echo str_repeat(" ",$depth),$v," [file]\n";
else
echo str_repeat(" ",$depth),$k," [directory]\n",print_dir($v,$depth+1);
}
}
print_dir($map,0);