document.write('<div class="php" style="font-family: monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Strips html from string</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> StripHTML<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$strString</span>, <span style="color: #0000ff;">$strAllowed</span> = <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">&#41;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Strip tags</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$strString</span> = <a target="_blank"&nbsp; href="http://www.php.net/strip_tags"><span style="color: #000066;">strip_tags</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$strString</span>, <span style="color: #0000ff;">$strAllowed</span><span style="color: #66cc66;">&#41;</span>;<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Remove evil</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <a target="_blank"&nbsp; href="http://www.php.net/preg_replace"><span style="color: #000066;">preg_replace</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">\'/&lt;(.*?)&gt;/ie\'</span>, <span style="color: #ff0000;">&quot;\'&lt;\'.StripHTMLHelper(\'<span style="color: #000099; font-weight: bold;">\\</span>1\').\'&gt;\'&quot;</span>, <span style="color: #0000ff;">$strString</span><span style="color: #66cc66;">&#41;</span>;<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Helper</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> StripHTMLHelper<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$strSource</span><span style="color: #66cc66;">&#41;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$strAttrb</span> = <span style="color: #ff0000;">&quot;\' (style|class)=<span style="color: #000099; font-weight: bold;">\&quot;</span>(.*?)<span style="color: #000099; font-weight: bold;">\&quot;</span>\'i&quot;</span>;<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$strSource</span> = <a target="_blank"&nbsp; href="http://www.php.net/stripslashes"><span style="color: #000066;">stripslashes</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$strSource</span><span style="color: #66cc66;">&#41;</span>;<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$strSource</span> = <a target="_blank"&nbsp; href="http://www.php.net/preg_replace"><span style="color: #000066;">preg_replace</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$strAttrb</span>, <span style="color: #ff0000;">\'\'</span>, <span style="color: #0000ff;">$strSource</span><span style="color: #66cc66;">&#41;</span>;<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$strSource</span>;<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />');
document.write('<span style="color: #000000; font-weight: bold;">?&gt;</span><br />');
document.write('&nbsp;</div>');
document.write('<br />&nbsp;<br /><div style="font-size: 12px">Brought to you by the community at <a href="http://www.bytemycode.com/snippets/snippet/10/1/" target="_blank">byteMyCode</a>.</div>');
