protected function removeDir($dir){
        foreach (scandir($dir) as $item){
            if ($item == "." || $item == "..")
                continue;

            if (is_dir($item)){
                removeDir($item);
            } else {
                unlink(join(DIRECTORY_SEPARATOR, array($dir, $item)));
            }

        }
        rmdir($dir);
    }
protected function removeDir($dir){
        foreach (scandir($dir) as $item){
            if ($item == "." || $item == "..")
                continue;

            if (is_dir($item)){
                removeDir($item);
            } else {
                unlink(join(DIRECTORY_SEPARATOR, array($dir, $item)));
            }

        }
        rmdir($dir);
    }
protected function removeDir ( $ dir ) { foreach ( scandir ( $ dir ) as $ item ) { if ( $ item == "." || $ item == ".." ) continue ; if ( is_dir ( $ item ) ) { removeDir ( $ item ) ; } else { unlink ( join ( DIRECTORY_SEPARATOR , array ( $ dir , $ item ) ) ) ; } } rmdir ( $ dir ) ; }
Removes a directory and all files contained inside
@param string $dir
Removes a directory and all files contained inside