PHP htmlspecialchars_decode() Function
Complete PHP String Reference
Definition and Usage
The htmlspecialchars_decode() function converts some predefined HTML entities to
characters.
HTML entities that will be decoded are:
- & becomes & (ampersand)
- " becomes " (double quote)
- ' becomes ' (single quote)
- < becomes < (less than)
- > becomes > (greater than)
The htmlspecialchars_decode() function is the opposite of
htmlspecialchars().
Syntax
htmlspecialchars_decode(string,quotestyle)
|
| Parameter |
Description |
| string |
Required. Specifies the string to decode |
| quotestyle |
Optional. Specifies how to decode single and double quotes. The available quote styles
are:
- ENT_COMPAT - Default. Decodes only double quotes
- ENT_QUOTES - Decodes double and single quotes
- ENT_NOQUOTES - Does not decode any quotes
|
Example 1
<?php
$str = "Jane & 'Tarzan'";
echo htmlspecialchars_decode($str);
echo "<br />";
echo htmlspecialchars_decode($str, ENT_QUOTES);
echo "<br />";
echo htmlspecialchars_decode($str, ENT_NOQUOTES);
?>
|
The browser output of the code above will be:
Jane & 'Tarzan'
Jane & 'Tarzan'
Jane & 'Tarzan'
|
If you select "View source" in the browser window, you will see the following
HTML:
<html>
<body>
Jane & 'Tarzan'<br />
Jane & 'Tarzan'<br />
Jane & 'Tarzan'
</body>
</html>
|
Example 2
<html>
<body>
<?php
$str = "My name is Øyvind Åsane. I'm Norwegian";
echo htmlspecialchars_decode($str, ENT_QUOTES);
?>
</body>
</html>
|
The browser output of the code above will be:
My name is Øyvind Åsane. I'm Norwegian
|
If you select "View source" in the browser window, you will see the following
HTML:
<html>
<body>
My name is Øyvind Åsane. I'm Norwegian
</body>
</html>
|
Complete PHP String Reference
 |
 |
 |
 |
|
The Ektron Intranet
lets you do everything you need to do on your corporate intranet and everything you want to do... all with just one application.
What can you do with the Ektron Intranet? |
 |
Navigate through content, documents, assets, colleagues and workgroups quickly and intuitively with enterprise search |
 |
Communicate with friends and colleagues with forums, message boards and corporate blogging using the new Social Networking Platform |

|
Utilize the extensive out-of-the box features or customize your site through Ektron CMS400.NET's open architecture |
 |
Promote collaboration in your organization through project workspaces where others can efficiently find information and work together |
 |
Author/edit content, manage navigation, menus, audit trails, workflow and approvals with the best in breed Content Management |
|
|
|
|
See why there are 20,000+ Ektron integrations worldwide.
|
|
 |
TAKE THE VIDEO TOUR |
 |
or download a FREE TRIAL today. |
|