// html (10 )
echo ''.getUnicodeFromOneUTF8(' ');
/**
* unicode , , ,
* : utf-8 ,
* , , php
* @author xieye
*
* @param {string} $word , ( str_split )
* @return {string} unicode , 4f60, “ ”
*/
function getUnicodeFromOneUTF8($word) {
// , utf-8 !
if (is_array( $word)){
$arr = $word;
}else{
$arr = str_split($word);
}
// ,$arr array(228, 189, 160)
//
$bin_str = '';
// , 。
foreach ($arr as $value) {
$bin_str .= decbin(ord($value));
}
//echo $bin_str;
// ,$bin_str 111001001 01111011 0100000, " "
//
$bin_str = preg_replace('/^.{4}(.{4}).{2}(.{6}).{2}(.{6})$/','$1$2$3', $bin_str);
// , $bin_str 0100111101100000, " "
return bindec($bin_str); // 20320, " "
//return dechex(bindec($bin_str)); // 4f60,
}
exit();