The htmlentities() function is key to security. It converts all characters that have corresponding
HTML entities into those entities (e.g., © becomes ©). This prevents the browser from
interpreting characters as HTML code. To do the reverse, we use html_entity_decode().
Note for the simulator: Since some string functions (such as htmlentities, htmlspecialchars, and html_entity_decode) modify raw HTML characters, the browser in the output window might not always display the exact raw output (as it automatically processes it). To see how these functions truly behave, we highly recommend copying and testing the code locally in your IDE (e.g., PhpStorm, VS Code).
Flags determine how the function handles quotation marks:
By default, the UTF-8 character encoding is used. The function also supports ENT_HTML401, ENT_XML1, ENT_XHTML, and ENT_HTML5 standards.