public function readFolder($folder, $sort = 0)
    {
        if (substr($folder, -1) != '/') $folder = $folder . '/';
        $this->data = @scandir($folder, $sort) or die("Error reading folder: '{$folder}'.");
        $this->numberOfFiles = count($this->data);
    }
public function readFolder($folder, $sort = 0)
    {
        if (substr($folder, -1) != '/') $folder = $folder . '/';
        $this->data = @scandir($folder, $sort) or die("Error reading folder: '{$folder}'.");
        $this->numberOfFiles = count($this->data);
    }
public function readFolder ( $ folder , $ sort = 0 ) { if ( substr ( $ folder , - 1 ) != '/' ) $ folder = $ folder . '/' ; $ this -> data = @ scandir ( $ folder , $ sort ) or die ( "Error reading folder: '{$folder}'." ) ; $ this -> numberOfFiles = count ( $ this -> data ) ; }
Reading the files and folders of a certain folder

@param string $folder The folder to read
@param int $sort How the data has to be sorted (Default: ascending)
- SCANDIR_SORT_DESCENDING: Sort descending (z -> a)
- SCANDIR_SORT_NONE: No sorting done

$this->data              An array with all the information of the folder
$this->numberOfFiles     The number of items found
Reading the files and folders of a certain folder