>>217
んな面倒なことせんでも2行でおさまるが。

$str = "掠";
ereg("&#([0-9]+);", $str, $match);
$str = "&#".sprintf("%x", $match[1]).";";