- html_entity_decode: documentation ( source)
- preg_replace: documentation ( source)
<?php
$string = html_entity_decode('äüuu');
echo preg_replace('#(&\#*\w+)[\x00-\x20]+;#u',"$1;",$string);
echo "\n";
$string = 'ss';
echo preg_replace('#(&\#*\w+)[\x00-\x20]+;#u',"$1;",$string);