如何将以下结果转换为数组?我想创建一个数组,这样我就可以分配给变量并使用它
if($handle = opendir($path)){
while(false != ($filename = readdir($handle))) {
if($filename != "." && $filename != ".."){
$name = preg_replace("/\\.[^.\\s]{3,4}$/", "", $filename);
$name = str_replace('_', ' ', $name);
$name = ucwords($name);
echo $name;
}
}
closedir($handle);
}