ciao, sto sperimentando la programmazione ad oggetti ma ho questo problema:
Codice PHP:
<?php
class my_directory
{
public $mydir;
public function _construct($mydir)
{
$this->mydir = $mydir;
}
public function get_dir()
{
if ($handle = opendir($this->mydir))
{
while (false !== ($file = readdir($handle)))
{
if ($file != "." && $file != "..")
{
$arr[] = $file;
sort($arr);
}
}
closedir($handle);
}
return $arr;
}
}
$categorie = new my_directory('games');
$tree = $categorie->get_dir();
var_dump($tree);
?>
ottengo NULL
perchè?