Can someone help me out? I cannot see it. The function below is not returning the array. The print_r($list)(above the return) prints the array on the screen. But the print_r($files)returns an empty array....
function listFolderFiles($dir){
$ffs = scandir($dir);
$i = 0;
$list = array();
foreach ( $ffs as $ff ){
if ( $ff != '.' && $ff != '..' ){
if ( strlen($ff)>=5 ) {
if ( substr($ff, -4) == '.mp4' ) {
$value = $dir.'/'.$ff;
$list[] = $value;
}
}
if( is_dir($dir.'/'.$ff) )
listFolderFiles($dir.'/'.$ff);
}
}
print_r($list); // Returns the full array with values
return $list;
}
$files = listFolderFiles($_POST['path']);
print_r($files) // Returns an empty array..... :(:(
($_POST('path'))? a typo?$_POST['path']print_rs are called, and one prints out the desired output, and one does not? Is it possible, that thePOSTvalue doesn't arrive/is not correct?if( is_dir($dir.'/'.$ff) )part. But there you are ignoring its return value.