PHP.nl

htmlspecialchars_decode

htmlspecialchars_decode

Convert special HTML entities back to characters

string **htmlspecialchars_decode** string $string int $flags

This function is the opposite of . It converts special HTML entities back to characters. htmlspecialchars

The converted entities are: , (when is not set), (when is set), and . &``"``ENT_NOQUOTES``'``ENT_QUOTES``<``>

stringThe string to decode.

flags A bitmask of one or more of the following flags, which specify how to handle quotes and which document type to use. The default is .

  `ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401`

Returns the decoded string.

Voorbeeld: A example

<?php
$str = "<p>this -&gt; &quot;</p>\n";

echo htmlspecialchars_decode($str);

// note that here the quotes aren't converted
echo htmlspecialchars_decode($str, ENT_NOQUOTES);
?>
<p>this -> "</p>
<p>this -> &quot;</p>

htmlspecialchars``html_entity_decode``get_html_translation_table