Re: htmlentities()

From: Date: Wed, 08 Sep 2004 23:34:18 +0000
Subject: Re: htmlentities()
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-196186@lists.php.net to get a copy of this message
Chris Shiflett wrote: > View source, and I think you'll understand. Or, remove the call to > htmlentities(). > > Chris .............. Thank you all for your assistance. Best... TR ........... "...when a browser sees &lt, it prints out a < character instead of thinking "OK here comes an HTML tag." This is the same idea (but with a differnt syntax) as escaping a " or $ charcater inside a double quoted string..." ~[from Learning PHP5 [O'Reilly] page 102] -------------------------------- <?php $str = "I <b>love</b> sweet tea and <div class=\"fancy\">rice.</div> & tea\n"; echo $str; echo "<br>"; echo htmlentities($str); ?> // Output in view source code: I <b>love</b> sweet tea and <div class="fancy">rice.</div> & tea <br>I &lt;b&gt;love&lt;/b&gt; sweet tea and &lt;div class=&quot;fancy&quot;&gt;rice.&lt;/div&gt; &amp; tea

« previous php.general (#196186) next »