public static function delTree($directory)
    {

        $files = array_diff(scandir($directory), array('.','..'));
		foreach ($files as $file) {
			$abspath = $directory.DIRECTORY_SEPARATOR.$file;
			if (is_dir($abspath)) {
				self::delTree($abspath);
			} else {
				unlink($abspath);
			}
		}
		return rmdir($directory);

    }
public static function delTree($directory)
    {

        $files = array_diff(scandir($directory), array('.','..'));
		foreach ($files as $file) {
			$abspath = $directory.DIRECTORY_SEPARATOR.$file;
			if (is_dir($abspath)) {
				self::delTree($abspath);
			} else {
				unlink($abspath);
			}
		}
		return rmdir($directory);

    }
public static function delTree ( $ directory ) { $ files = array_diff ( scandir ( $ directory ) , array ( '.' , '..' ) ) ; foreach ( $ files as $ file ) { $ abspath = $ directory . DIRECTORY_SEPARATOR . $ file ; if ( is_dir ( $ abspath ) ) { self :: delTree ( $ abspath ) ; } else { unlink ( $ abspath ) ; } } return rmdir ( $ directory ) ; }
deletes a directory and its content.

@author Lionel Lecaque, <lionel@taotesting.com>
@param  string directory absolute path of the directory
@return boolean true if the directory and its content were deleted, false otherwise.
deletes a directory and its content .