public static function recursiveDelete($path) {
		if(is_file($path)) {
			@unlink($path);

		} else {
			$it = new RecursiveIteratorIterator(
				new RecursiveDirectoryIterator($path),
				RecursiveIteratorIterator::CHILD_FIRST
			);

			foreach ($it as $file) {
				if (in_array($file->getBasename(), array('.', '..'))) {
					continue;
				}elseif ($file->isDir()) {
					rmdir($file->getPathname());
				}elseif ($file->isFile() || $file->isLink()) {
					unlink($file->getPathname());
				}
			}
			rmdir($path);
		}

		return false;
	}
public static function recursiveDelete($path) {
		if(is_file($path)) {
			@unlink($path);

		} else {
			$it = new RecursiveIteratorIterator(
				new RecursiveDirectoryIterator($path),
				RecursiveIteratorIterator::CHILD_FIRST
			);

			foreach ($it as $file) {
				if (in_array($file->getBasename(), array('.', '..'))) {
					continue;
				}elseif ($file->isDir()) {
					rmdir($file->getPathname());
				}elseif ($file->isFile() || $file->isLink()) {
					unlink($file->getPathname());
				}
			}
			rmdir($path);
		}

		return false;
	}
public static function recursiveDelete ( $ path ) { if ( is_file ( $ path ) ) { @ unlink ( $ path ) ; } else { $ it = new RecursiveIteratorIterator ( new RecursiveDirectoryIterator ( $ path ) , RecursiveIteratorIterator :: CHILD_FIRST ) ; foreach ( $ it as $ file ) { if ( in_array ( $ file -> getBasename ( ) , array ( '.' , '..' ) ) ) { continue ; } elseif ( $ file -> isDir ( ) ) { rmdir ( $ file -> getPathname ( ) ) ; } elseif ( $ file -> isFile ( ) || $ file -> isLink ( ) ) { unlink ( $ file -> getPathname ( ) ) ; } } rmdir ( $ path ) ; } return false ; }
Delete files and folder recursively

@param string $path path of file/folder
Delete files and folder recursively