PHP html_entitiy_decode is an inbuilt function in PHP. It converts HTML Entities back to their corresponding characters. It works the opposite of PHP htmlentities Function. In this article, we will discuss the PHP html_entity_decode Function.
Note: To convert characters to HTML entities, use the PHP htmlentities Function.
html_entity_decode ($string, $flags, $encoding)
The PHP html_entity_decode Function accepts three parameters. However, only one parameter is mandatory and the other two are optional. The description of the parameters is as follows:
- $string: The first parameter specifies the input string to convert.
- $flags: The second parameter specifies how to handle quotes. It is a combination of two or more flags. You can refer to the list of all the available flags on PHP.net.
- $encoding: The third parameter specifies the encoding to use while converting. By default, the function uses the default PHP encoding. You can refer to the supported encoding parameters on PHP.net.
The PHP html_entity_decode function returns a string after converting all the HTML entities back to their corresponding characters. It uses the UTF-8 as the default encoding.
<?php echo html_entity_decode($inputString); ?>
Vishesh is currently working as a Lead Software Engineer at Naukri.com. He passed out of Delhi College of Engineering in 2016 and likes to play Foosball. He loves traveling and is an exercise freak. His expertise includes Java, PHP, Python, Databases, Design and Architecture.