你可以这样做:
function utfOrd($c) {
return intval(array_pop(unpack('H*', $c)),16);
}
function utfChr($c) {
return pack('H*', base_convert("$c", 10, 16));
}
var_dump(array_map('utfChr', range(utfOrd('א'), utfOrd('ת'))));
打印:
array
0 => string 'א' (length=2)
1 => string 'ב' (length=2)
2 => string 'ג' (length=2)
3 => string 'ד' (length=2)
4 => string 'ה' (length=2)
5 => string 'ו' (length=2)
6 => string 'ז' (length=2)
7 => string 'ח' (length=2)
8 => string 'ט' (length=2)
9 => string 'י' (length=2)
10 => string 'ך' (length=2)
11 => string 'כ' (length=2)
12 => string 'ל' (length=2)
13 => string 'ם' (length=2)
14 => string 'מ' (length=2)
15 => string 'ן' (length=2)
16 => string 'נ' (length=2)
17 => string 'ס' (length=2)
18 => string 'ע' (length=2)
19 => string 'ף' (length=2)
20 => string 'פ' (length=2)
21 => string 'ץ' (length=2)
22 => string 'צ' (length=2)
23 => string 'ק' (length=2)
24 => string 'ר' (length=2)
25 => string 'ש' (length=2)
26 => string 'ת' (length=2)
如果您需要更多字符,可以使用它来创建硬编码数组或合并少量范围.