HTML,PHP - Escape '<' and '>' symbols while echoing
Solution 1:
Use htmlspecialchars.
<?php
echo htmlspecialchars("abc & < >");
?>
Solution 2:
echo htmlentities("<label> AAAAA");
Solution 3:
<?php
$string = "<label> AAAAA"; //whatever you want
echo htmlspecialchars($string);
?>
refrence htmlspecialchars
Solution 4:
Use the htmlentities()
function to convert into a plain text string.
<?php
echo htmlentities("<label> AAAAA");
?>
Solution 5:
check this http://php.net/manual/en/function.htmlentities.php, and this is code -
echo htmlentities ("<label> AAAAA");