All pastes #75660 Raw Edit

Something

public text v1 · immutable
#75660 ·published 2006-06-30 12:21 UTC
rendered paste body
<?php
$code=file_get_contents('http://pastebin.ca/');
list($usec, $sec) = explode(' ', microtime());
$start=((float)$usec + (float)$sec);
$from=array(
	'!<([^/][^> ]*)[^>]*>(.*?)</\1>!s',
	'!<([^>]*/|\!--[^>]*--|\?[^>]*\?)>!'
);
$to=array('$2', '');
while (!isset($tmp) || ($code != $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)) {
		foreach ($m[1] as $tag)  {
			$err_count++;
			echo 'line '.($num+1).': un'.($tag{0} != '/' ? 'clos' : 'open')."ed tag $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/>';
?>