public static function delete($path)
    {
        if (!is_readable($path)) {
            return false;
        }

        if (!is_dir($path)) {
            unlink($path);
            return true;
        }

        foreach (scandir($path) as $file) {
            if ($file === '.' || $file === '..') {
                continue;
            }
            $file = $path . '/' . $file;
            if (is_dir($file)) {
                self::delete($file);
            } else {
                unlink($file);
            }
        }

        rmdir($path);

        return true;
    }
public static function delete($path)
    {
        if (!is_readable($path)) {
            return false;
        }

        if (!is_dir($path)) {
            unlink($path);
            return true;
        }

        foreach (scandir($path) as $file) {
            if ($file === '.' || $file === '..') {
                continue;
            }
            $file = $path . '/' . $file;
            if (is_dir($file)) {
                self::delete($file);
            } else {
                unlink($file);
            }
        }

        rmdir($path);

        return true;
    }
public static function delete ( $ path ) { if ( ! is_readable ( $ path ) ) { return false ; } if ( ! is_dir ( $ path ) ) { unlink ( $ path ) ; return true ; } foreach ( scandir ( $ path ) as $ file ) { if ( $ file === '.' || $ file === '..' ) { continue ; } $ file = $ path . '/' . $ file ; if ( is_dir ( $ file ) ) { self :: delete ( $ file ) ; } else { unlink ( $ file ) ; } } rmdir ( $ path ) ; return true ; }
Deletes a file or directory recursively.
Deletes a file or directory recursively .