Jump to content

html entities does not work


dsaba

Recommended Posts

this is weird is there a setting in php.ini that turns off this?

i am using a freehost to upload .php files

(yes i know i can use my own pc)

 

anyways i copied the exact example from php.net

 

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

// Outputs: A 'quote' is <b>bold</b>
echo htmlentities($str);

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

 

and it did not work it gave me the string just like it is

 

why?

Link to comment
https://forums.phpfreaks.com/topic/41915-html-entities-does-not-work/
Share on other sites

For the purposes of security, you might want to use strip_tags():

 

http://sg.php.net/manual/en/function.strip-tags.php

 

Regarding security, calling htmlentities() once should ensure that html is displayed, rather than interpreted by the browser.  You should see the bold tags instead of seeing bold text.

 

If you really want to see the htmlentities() output in the browser, call htmlentities() twice.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.