I tried to make function to show all files and dir(if have) in one selected dir.
class Test{
private $directory;
public function getDir($directory){
$this->directory = realpath($directory);
$scan = scandir($this->directory);
foreach ($scan as $value) {
if(!is_dir($this->directory.DIRECTORY_SEPARATOR.$value)){
echo '<span style="color:blue">'.$value.'</span><br>';
}else{
echo '<span style="color:red">'.$value.'</span><br>';
//Here I tried to return getDir($value) - but I retype $directory any ideas ?
}
}
}
I thought over this how to make but ... Little help will be really nice. Excuse my bad english.