public static function clear_directory($directory)
    {
        foreach (scandir($directory) as $file) {
            if ($file !== '.' and $file !== '..') {
                unlink($directory.$file);
            }
        }
    }
public static function clear_directory($directory)
    {
        foreach (scandir($directory) as $file) {
            if ($file !== '.' and $file !== '..') {
                unlink($directory.$file);
            }
        }
    }
public static function clear_directory ( $ directory ) { foreach ( scandir ( $ directory ) as $ file ) { if ( $ file !== '.' and $ file !== '..' ) { unlink ( $ directory . $ file ) ; } } }
Delete all the files from a directory.

@param string $directory
Delete all the files from a directory .