当前位置: 首页 > 图文教程 > 网络编程 > PHP > 单汉字转UNICODE
PHP 中的 单汉字转UNICODE
出处:互联网 整理: 软晨网(RuanChen.com) 发布: 2009-08-19 浏览: 877 ::
收藏到网摘:
n/a
-
-
-
-
-
-
-
-
-
- function getUnicodeFromOneUTF8($word) {
-
- if (is_array( $word))
- $arr = $word;
- else
- $arr = str_split($word);
-
-
- $bin_str = '';
-
- foreach ($arr as $value)
- $bin_str .= decbin(ord($value));
-
-
- $bin_str = preg_replace('/^.{4}(.{4}).{2}(.{6}).{2}(.{6})$/','$1$2$3', $bin_str);
-
- return bindec($bin_str);
-
- }