Unicode.php 包含一些用于操作 Unicode 数据的 PHP 类和方法。
使用示例:
` require(‘Unicode.php’);
$string = new Unicode_String(); $string->fromUTF8(“Ĥēĺļŏ, Ŵőřļď!”);
print “String contains “.$string->length().” characters.\n”;
print “String contains characters from the following blocks:”.implode(‘, ‘, $string->blocks()).”\n”;
print “String in UTF-8: “.$string->toUTF8().”\n”;
print “String in UPPERCASE: “.$string->toUpper()->toUTF8().”\n”;
$comma = new Unicode_Character(ord(‘,’));
$words = explode($comma);
foreach ($words as $word) { print “Word has “.$word->length().” characters.\n”; }
?>`