Tutorialsplane

PHP htmlspecialchars_decode Function


PHP htmlspecialchars_decode Function : It converts Some HTML entities to its characters equivalent. This function is opposite of htmlspecialchars() function. We are going to explain this example with example and demo.


PHP htmlspecialchars_decode Function Syntax

It Converts the following entities only –

Here is syntax for the function htmlspecialchars_decode

Syntax

htmlspecialchars_decode(string,flags)

Input Parameters

Here are following flags available-

Return Values

This function returns the converted string.

PHP htmlspecialchars_decode Function Example-

Let’s understand the above function with example and demo –

PHP htmlspecialchars_decode

$string = "<p>Hello World -> "</p>";
echo htmlspecialchars_decode($string);

Try it »

The above example will produce the following output-

Html Output

Browser Output


More Example

Let’s have a look over more example and demo here. Here we will explain example with flags.

PHP htmlspecialchars_decode

$string = "<p>Hello ' World ->Learn & More Here  "</p>";
echo htmlspecialchars_decode($string, ENT_COMPAT)."<br/>";
echo htmlspecialchars_decode($string, ENT_QUOTES)."<br/>";
echo htmlspecialchars_decode($string, ENT_NOQUOTES)."<br/>";

Try it »

The above example will produce the following output-

Html Output

Browser Output

PHP String Functions