public static function listFiles(string $directory, string $regex = "*"): array
    {
        $files = array();
        foreach (glob($directory . $regex) as $filepath) {
            $files[] = $filepath;
        }
        
        return $files;
    }
public static function listFiles(string $directory, string $regex = "*"): array
    {
        $files = array();
        foreach (glob($directory . $regex) as $filepath) {
            $files[] = $filepath;
        }
        
        return $files;
    }
public static function listFiles ( string $ directory , string $ regex = "*" ) : array { $ files = array ( ) ; foreach ( glob ( $ directory . $ regex ) as $ filepath ) { $ files [ ] = $ filepath ; } return $ files ; }
List all files in the specified directory.

@param string $directory
Path to the directory to list the files for.

@param string $regex
Regular expression. Files to be listed have to match this if specified.

@return string[] Files in the specified directory, matching the optional regex if specified.
List all files in the specified directory .