Unicode庫 Unicode.php

jopen 14年前發布 | 23K 次閱讀 PHP PHP開發

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

項目主頁:http://www.baiduhome.net/lib/view/home/1326766035140

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!