Version: 1.0
Type: Function
Category: Other
License: GNU General Public License
Description: This function uses regular expressions to take HTML input and output it as easy-to-read syntax highlighted code.
<? function highlight_html($code) { $code = htmlentities($code); $code = preg_replace("/([a-zA-Z_]+)=/", "<font color="#FF0000">$1=</font>", $code); $code = preg_replace("/(<[/a-zA-Z0-9&;]+)/", "<font color="#0000FF">$1</font>", $code); $code = str_replace("<!--", "<font color="#008080"><!--", $code); $code = str_replace("-->", "--></font>", $code); $code = preg_replace("/[rn]+/", "n", $code); return $code; } ?>