Here is my php code:
function readDirectory($path) {
$handle = opendir($path);
while( $item = readdir($handle) !== false) {
if($item != "." && $item != "."){
if (is_file($path . "/" . $item)) {
$arr ['file'] [] = $item;
}
if (is_dir($path . "/" . $item)) {
$arr ['dir'] [] = $item;
}
}
}
closedir($handle);
return $arr; //line 24
}
$path = "file";
print_r(readDirectory($path));
But constantly getting these errors:
Notice: Undefined variable: arr in /Users/tyrant/workspace/apache/fileManager/dir.func.php on line 24
How do I resolve this problem?