<?php
/* tell tidy to automatically clean & repair output */
ini_set("tidy.clean_output"TRUE);

/* set tidy output buffer, which will by default 
 * automatically correct HTML output */
ob_start("ob_tidyhandler");
?>
<B>testing</I>
Output
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title></title>
</head>
<body>
<b>testing</b>
</body>
</html>