htmlspecialchars_decode() function in PHP
×


htmlspecialchars_decode() function in PHP

1922

htmlspecialchars_decode() function of PHP is used to convert predefined HTML entities to normal characters.

It is an inbuilt function of PHP. The return type of this function is string means it returns decoded string.

Note:

To converts normal characters to predefined HTML entities, use htmlspecialchars() PHP function.

Syntax:

htmlspecialchars_decode($string,flags);

here,

1. $string is a PHP string that HTML entities to be decoded into normal characters by this function. It is mandatory.

2. flags used to specify the quotes and document type used by the function. It is an optional parameter. The possible values for this are

For quotes

  • ENT_COMPAT
  • ENT_QUOTES
  • ENT_NOQUOTES

For document type

  • ENT_HTML401
  • ENT_HTML5
  • ENT_XML1
  • ENT_XHTML

Example:

<?php
$string = "&lt;,&gt;,&copy;,&amp;";
$a=htmlspecialchars_decode($string);
echo "Decoded symbols are : <br>";
echo $a;
?>

Output:



Best WordPress Hosting


Share:


Discount Coupons

Get a .COM for just $6.98

Secure Domain for a Mini Price



Leave a Reply


Comments
    Waiting for your comments