Decodes all HTML entities (including numerical ones) to regular UTF-8 bytes.
Double-escaped entities will only be decoded once ("&lt;" becomes "<" , not "<"). Be careful when using this function, as decode_entities can revert previous sanitization efforts (<script> will become <script>).
$text: The text to decode entities in.
The input $text, with all HTML entities decoded once.
function decode_entities($text) {
return html_entity_decode($text, ENT_QUOTES, 'UTF-8');
}