private static function rmdirRecursive($path)
    {
        $files = scandir($path);
        array_shift($files);
        array_shift($files);

        foreach ($files as $file) {
            $file = $path.DIRECTORY_SEPARATOR.$file;
            if (is_dir($file)) {
                self::rmdirRecursive($file);
            } else {
                unlink($file);
            }
        }

        rmdir($path);
    }
private static function rmdirRecursive($path)
    {
        $files = scandir($path);
        array_shift($files);
        array_shift($files);

        foreach ($files as $file) {
            $file = $path.DIRECTORY_SEPARATOR.$file;
            if (is_dir($file)) {
                self::rmdirRecursive($file);
            } else {
                unlink($file);
            }
        }

        rmdir($path);
    }
private static function rmdirRecursive ( $ path ) { $ files = scandir ( $ path ) ; array_shift ( $ files ) ; array_shift ( $ files ) ; foreach ( $ files as $ file ) { $ file = $ path . DIRECTORY_SEPARATOR . $ file ; if ( is_dir ( $ file ) ) { self :: rmdirRecursive ( $ file ) ; } else { unlink ( $ file ) ; } } rmdir ( $ path ) ; }
Removes files and folders recursively at provided path.

@param string $path
Removes files and folders recursively at provided path .