PHP获取所有汉字的Unicode编码

$start = hexdec('4e00');
$end = hexdec('9fa5');

$s = [];

while(True) {
    $k = dechex($start);
    if ($start > $end) {
        break;
    }
    $s[] = $k . ' ' . json_decode('["\u'.$k.'"]')[0];
    $start++;
}

file_put_contents('u.txt', implode("\n", $s));