Most of you probably know that there are 3 basic HTML special characters reserved for HTML tags and entities: (<), (>) and (&).
But there are 2 more characters reserved for quoting tag attributes: (") and (').
If you don't protect those characters, your Web page will not work. Try the following HTML code, and see what happens:
Question: is it true that 23:59 < 00:00?<br> Answer: <input value='it's true.'>
How to use and test htmlentities() PHP function?
htmlentities(string) is identical to htmlspecialchars() in all ways, except with htmlentities(), all characters which have HTML character entity equivalents are converted into these entities. For example
- '&' (ampersand) becomes '&'
- '"' (double quote) becomes '"'
- ''' (single quote) becomes ''' only when ENT_QUOTES is set. Not a default behavior.
- '<' (less than) becomes '<'
- '>' (greater than) becomes '>'
To help you learn and test htmlentities() function, FYIcenter.com has designed this online testing page. All you need to do is to enter the testing string in the form below and click the Start button. The converted string will be presented in the result area.
discuss this topic to forum
