1 - folder2array()
function folder2array($path=''){
//$path=empty($path)?'./':$path;
$array=[];
$current_dir=glob($path.'/*');
if ($current_dir[0]==$path) unset($current_dir[0]);
foreach ($current_dir as $key => $item) {
if (is_file($item)){
$array[]=$item;
}else{
$array[]=folder2array($item);
}
}
return $array;
}