<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tech Blog &#187; strip_tags</title>
	<atom:link href="http://informationideas.com/news/tag/strip_tags/feed/" rel="self" type="application/rss+xml" />
	<link>http://informationideas.com/news</link>
	<description>Using technology to help your business</description>
	<lastBuildDate>Tue, 06 Dec 2011 06:39:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>php strip_tags problem</title>
		<link>http://informationideas.com/news/2008/05/19/php-strip_tags-problem/</link>
		<comments>http://informationideas.com/news/2008/05/19/php-strip_tags-problem/#comments</comments>
		<pubDate>Mon, 19 May 2008 17:34:45 +0000</pubDate>
		<dc:creator>frank</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[strip_tags]]></category>

		<guid isPermaLink="false">http://informationideas.com/news/2008/05/19/php-strip_tags-problem/</guid>
		<description><![CDATA[I found that using php function, strip_tags, does not remove all the markup elements correctly from the subject content.Â  First of all, if an anchor link includes a line break, it will not be removed correctly.Â  Also, the style information is not properly removed as well.Â  In the following script, I also added in the [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop --><!-- End Shareaholic LikeButtonSetTop --><p>I found that using php function, strip_tags, does not remove all the markup elements correctly from the subject content.Â  First of all, if an anchor link includes a line break, it will not be removed correctly.Â  Also, the style information is not properly removed as well.Â  In the following script, I also added in the regex to remove any content in between script tags, but that may or may not be necessary.</p>
<p>function strip_all_tags($content)<br />
{<br />
$content = preg_replace('/\n/',' ',$content);<br />
$content = preg_replace('/&lt;script.*&lt;\/script&gt;/U',' ',$content);<br />
$content = preg_replace('/&lt;style.*&lt;\/style&gt;/U',' ',$content);<br />
$content = strip_tags(strtolower($content));<br />
return $content;<br />
}</p>
<p>The function will remove all line breaks so strip_tags will not have problems with finding all markups.Â  Since strip_tags does not remove &lt;style&gt; tags, the new function will remove them using regex.</p>
<div class="shr-publisher-51"></div><!-- Start Shareaholic LikeButtonSetBottom --><!-- End Shareaholic LikeButtonSetBottom -->]]></content:encoded>
			<wfw:commentRss>http://informationideas.com/news/2008/05/19/php-strip_tags-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.324 seconds -->

