public static function deleteDirectory($dir) {
		if (is_dir($dir))
			$dirHandle = opendir($dir);
		
		if (!$dirHandle)
			return false;
		
		while ($file = readdir($dirHandle)) {
			if ($file != "." && $file != "..") {
				if (!is_dir($dir."/".$file))
					unlink($dir."/".$file);
				else
					self::deleteDirectory($dir.'/'.$file);          
			}
		}
		
		closedir($dirHandle);
		rmdir($dir);
		return true;
	}
public static function deleteDirectory($dir) {
		if (is_dir($dir))
			$dirHandle = opendir($dir);
		
		if (!$dirHandle)
			return false;
		
		while ($file = readdir($dirHandle)) {
			if ($file != "." && $file != "..") {
				if (!is_dir($dir."/".$file))
					unlink($dir."/".$file);
				else
					self::deleteDirectory($dir.'/'.$file);          
			}
		}
		
		closedir($dirHandle);
		rmdir($dir);
		return true;
	}
public static function deleteDirectory ( $ dir ) { if ( is_dir ( $ dir ) ) $ dirHandle = opendir ( $ dir ) ; if ( ! $ dirHandle ) return false ; while ( $ file = readdir ( $ dirHandle ) ) { if ( $ file != "." && $ file != ".." ) { if ( ! is_dir ( $ dir . "/" . $ file ) ) unlink ( $ dir . "/" . $ file ) ; else self :: deleteDirectory ( $ dir . '/' . $ file ) ; } } closedir ( $ dirHandle ) ; rmdir ( $ dir ) ; return true ; }
Delete a directory

@param string $dir - directory to delete
@return boolean
Delete a directory