Created
March 5, 2018 08:28
-
-
Save yehgdotnet/5b7562b46e6da6d05fc5b7ff35163bbb to your computer and use it in GitHub Desktop.
htmlspecialchars vs htmlentities
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$s = $_GET['s']; | |
echo '<h1>htmlentities</h1>'; | |
echo '<h1'.htmlentities($s,ENT_QUOTES).'>HELLO</h1>'; | |
echo '<h2>htmlspecialchars</h2>'; | |
echo '<h1'.htmlspecialchars($s,ENT_QUOTES).'>HELLO</h1>'; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment