In PHP htmlentities()
convert all applicable characters to HTML entities, while htmlspecialchars()
convert special character to HTML entities. Htmlspecilachars()
convert only single quote, double quote, <, >
and ampersand when htmlentities()
convert all the types of characters.