<?php
function utf8_replaceEntity($result){
$value = (int)$result[1];
$string = '';
$len = round(pow($value,1/8));
for($i=$len;$i>0;$i--){
$part = ($value & (255>>2)) | pow(2,7);
if ( $i == 1 ) $part |= 255<<(8-$len);
$string = chr($part) . $string;
$value >>= 6;
}
return $string;
}function utf8_html_entity_decode($string){
return preg_replace_callback(
'/&#([0-9]+);/u',
'utf8_replaceEntity',
$string
);
}
$string = '&#21326;&#21335;';
$string = utf8_html_entity_decode($string);
header('Content-Type: text/html; charset=UTF-8');
echo '<li>'.$string;
?>