How to display html tags as plain text in react
- php show html tags
- php show html tags in string
- php echo html tags
- php display html tags from database
Php display html tags from database!
How to Display HTML Tags as Plain Text using PHP?
HTML tags begin with the less-than character and end with greater-than character, the text inside the tag formatted and presented according to the tag used.
How to display html code as text in web page
Every tag has special meaning to the browser but there are cases when to show plain HTML code in webpage. There are various methods in PHP to show the HTML tags as plain text, some of them are discussed below:
Method 1: Using htmlspecialchars() Function
The htmlspecialchars() function is an inbuilt function in PHP which is used to convert all predefined characters to HTML entities.
Syntax:
string htmlspecialchars( $string, $flags, $encoding, $double_encode )- $string: This parameter is used to hold the input string.
- $flags: This parameter is used to hold the flags.
It is combination of one or two flags, which tells how to handle quotes.
- $encoding: It is an optional argument which specifies the encoding which is used when characters are converted. If encoding is not given then it is converted according to PHP default version.
- $double_encode: If
- php echo html tags not working
- php show html code