Strip_tags
Remove HTML and PHP tags.
Syntax: string strip_tags (string str );
Return Value: String
Correspondence type: Data Processing
Description
This function removes any HTML and PHP tag strings contained in the string. If the HTML and PHP tags of a string are incorrect, for example, if a greater symbol is missing, an error is returned. This function has the same function as fgetss.
Htmlspecialchars
Convert special characters to HTML format.
Syntax: string htmlspecialchars (string );
Return Value: String
Correspondence type: Data Processing
This function converts special characters into the string format of HTML (&....;). The most common use case may be the message board for handling customer messages.
& (And) &
"(Double quotation marks)"
<(Less than) to <
> (Greater than) to>
''(Single quotes)'
This function only converts the preceding special characters and does not convert all the characters to the ASCII conversion specified in HTML.
Copy codeThe Code is as follows: <? Php
$ New = htmlspecialchars ("<a href = 'test'> test </a>", ENT_QUOTES );
Echo $ new;
?>
Result: <a href = 'test'> test </a>