Unicode.phpUnicode库

联合创作 · 2023-09-28 21:58

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";
}

?>

浏览 4
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报