PHP html_entity_decode Function

What is html_entity_decode Function?

Explanation

In PHP, this function is used to convert all HTML entities to their applicable characters.

Syntax:


html_entity_decode(string,quotestyle,character-set)

In the above syntax "string" specifies the text to decode, "quotestyle" specifies how to decode single and double quotes,"characterset" specifies the character set to be used.

Example :


<?php
$str = "Hiox & 'India'";
echo html_entity_decode($str);
echo "<br />";
echo html_entity_decode($str, ENT_QUOTES);
echo "<br />";
echo html_entity_decode($str, ENT_NOQUOTES);
?>
Result :

Hiox & 'India'
Hiox & 'India'
Hiox & 'India'

In the above example the different quotestyles "ENT_QUOTES",which decodes both single and double quotes, "ENT_NOQUOTES" which doesnt decode any quotes are used.

NOTE:


Please use "View Source" to know the exact output of the function

PHP Topics


Ask Questions

Ask Question