<?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,$path)
{
$buff = '';
foreach ($in as $k => $v)
{
if (!is_array($v))
$buff .= "[file]: ".$path.$v."\n";
else
$buff .= "[directory]: ".$path.$k."\n".print_dir($v,$path.$k.DIRECTORY_SEPARATOR);
}
return $buff;
}
echo print_dir($map,'');