Log in

View Full Version : htmlentities() not working as it supposed



codeexploiter
03-06-2007, 05:30 AM
I've tried to execute the below mentioned PHP code (which is directly from PHP manual)


<?php
$str = "A 'quote' is <b>bold</b>";

// Outputs: A 'quote' is &lt;b&gt;bold&lt;/b&gt;
echo htmlentities($str);

// Outputs: A &#039;quote&#039; is &lt;b&gt;bold&lt;/b&gt;
echo htmlentities($str, ENT_QUOTES);
?>

But it didn't work as it supposed I mean I got the output like the following not like what they claim in the manual.


A 'quote' is <b>bold</b>A 'quote' is <b>bold</b>

I am using PHP version 5.2.0

I wonder why it is not working as it supposed.

Can any please test and let me know about it?

Thanks in advance

regards

tech_support
03-06-2007, 05:33 AM
What page is it?
What are you trying to do?

codeexploiter
03-06-2007, 06:08 AM
ok i think i've figured it out the functions works but when the browser renders it display its corresponding html characters rather than entity characters.