All pastes #75603 Raw Edit

Stuff

public text v1 · immutable
#75603 ·published 2006-06-30 10:25 UTC
rendered paste body
<?php
$code=file_get_contents('http://pastebin.ca/75572');
list($usec, $sec) = explode(' ', microtime());
$start=((float)$usec + (float)$sec);
$from=array(
	'!<([^/][^> ]*)[^>]*>(.*?)</\1>!s',
	'!<([^>]*/|\!--[^>]*--|\?[^>]*\?)>!'
);
$to=array('$2', '');
while (!isset($tmp) || $code != $tmp) {
	if (isset($tmp)) $code=$tmp;
	$tmp=preg_replace($from, $to, $code);
}
$lines=explode("\n", $code);
$err_count=0;
foreach ($lines as $num=>$line) {
	if (preg_match_all('!<([^/][^> ]*)[^>]*>|</([^> ]*)[^>]*>!', $line, $m, PREG_PATTERN_ORDER)) {
		for ($i=1; $i != 2; $i=2) {
			foreach ($m[$i] as $tag) if ($tag != '') {
				$err_count++;
				echo 'line '.($num+1).': un'.($i == 1 ? 'clos' : 'open').'ed tag '.htmlspecialchars($tag).'<br/>';
			}
		}
	}
}
if ($err_count > 0) echo "Found $err_count bad tags!<br/>";
else echo 'The code is okay..<br/>';
list($usec, $sec) = explode(' ', microtime());
echo ((float)$usec + (float)$sec - $start) . '<br/>';
?>