- var_dump: documentation ( source)
- htmlspecialchars_decode: documentation ( source)
- html_entity_decode: documentation ( source)
<?php
$x = '111&laquo;123!&raquo;456&amp;nbsp;789 ';
var_dump($x, htmlspecialchars_decode(htmlspecialchars_decode(html_entity_decode($x, ENT_QUOTES, 'UTF-8'), ENT_QUOTES), ENT_QUOTES));