<?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>PHP Reference Book Blog &#187; strip_tags</title>
	<atom:link href="http://www.phpreferencebook.com/tag/strip_tags/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phpreferencebook.com</link>
	<description>PHP Reference: Beginner to Intermediate PHP5</description>
	<lastBuildDate>Thu, 29 Sep 2011 03:50:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Strip_tags() &#8211; Less Than you Bargained For</title>
		<link>http://www.phpreferencebook.com/tips/strip_tags/</link>
		<comments>http://www.phpreferencebook.com/tips/strip_tags/#comments</comments>
		<pubDate>Sun, 30 Nov 2008 22:04:40 +0000</pubDate>
		<dc:creator>Mario Lurig</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[greater than]]></category>
		<category><![CDATA[htmlspecialchars]]></category>
		<category><![CDATA[less than]]></category>
		<category><![CDATA[strip_tags]]></category>

		<guid isPermaLink="false">http://www.phpreferencebook.com/?p=19</guid>
		<description><![CDATA[While this may be handy for removing HTML from a string, be forewarned that the function is a lot less picky than you may think when it comes to the less than symbol ( &#60; ). First, the section from the PHP book: strip_tags($string [, allowed_tags]) allowed_tags – [optional] $string Remove HTML tags and comments [...]]]></description>
			<content:encoded><![CDATA[<p>While this may be handy for removing HTML from a string, be forewarned that the function is a lot less picky than you may think when it comes to the less than symbol ( &lt; ). First, the section from the <a href="http://www.phpreferencebook.com/purchase/">PHP book</a>:</p>
<hr /><strong>strip_tags($string [, <em>allowed_tags</em>])</strong></p>
<p><em>allowed_tags </em>– [optional] $string</p>
<p>Remove HTML tags and comments from $string. If specific tags should be<br />
excluded, they can be specified inside allowed_tags.</p>
<p>Examples:<br />
<code>$string = "&lt;p&gt;This is a paragraph. &lt;/p&gt;&lt;strong&gt;Yay!&lt;/strong&gt;";<br />
echo strip_tags($string), strip_tags($string, '&lt;p&gt;');</code></p>
<p>HTML Source Code:</p>
<p><code>This is a paragraph. Yay! &lt;p&gt;This is a paragraph. &lt;/p&gt;Yay!</code></p>
<hr />So what happens to the following example, when we want to remove all the tags? Fair warning, something strange happens:</p>
<p><code>$string = "I &lt;strong&gt;love&lt;/strong&gt; this book because it costs &lt;$20.";<br />
echo strip_tags($string);</code></p>
<p>HTML Source Code:</p>
<p><code>I love this book because it costs</code></p>
<p>As you can see, it removed the &lt;$20 portion of the string as well, even without the closing greater than ( &gt; ) tag at the end. Be careful when using <strong>strip_tags()</strong>, especially without specifying the <em>allowed tags</em>, or consider using an alternate such as <strong>htmlspecialchars()</strong> to encode the characters into their html equivalent rather than removing them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpreferencebook.com/tips/strip_tags/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

