PHP htmlspecialchars_decode() Function
You are Here:
PHP htmlspecialchars_decode()
The htmlspecialchars_decode()
function converts special HTML entities back to characters.
HTML entities decoded back to the character will be like:
- & becomes & (ampersand)
- " becomes " (double quote)
- ' becomes ' (single quote)
- < becomes < (less than)
- > becomes > (greater than)
Note: This function is the opposite of htmlspecialchars().
Example
PHP Compiler
<?php
$str = "This is <u> underline </u>";
echo htmlspecialchars_decode($str) . "<br>";
?>
Output
This is underline
Syntax
htmlspecialchars_decode(str, flag)
Parameter Values
Value | Type | Explanation |
---|---|---|
str | Required | Specifies the string to decode. |
flag | Optional | Specify how to handle quotes and which document type to use. Possible Values:
|
Return Value
Value | Explanation |
---|---|
Number | Returns the decoded string. |
Reminder
Hi Developers, we almost covered 90% of String functions and Interview Question on PHP with examples for quick and easy learning.
We are working to cover every Single Concept in PHP.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.