41 for($i = 0; $i < $len; $i++) {
49 if (0 == (0x80 & ($in))) {
53 }
else if (0xC0 == (0xE0 & ($in))) {
56 $mUcs4 = ($mUcs4 & 0x1F) << 6;
60 }
else if (0xE0 == (0xF0 & ($in))) {
63 $mUcs4 = ($mUcs4 & 0x0F) << 12;
67 }
else if (0xF0 == (0xF8 & ($in))) {
70 $mUcs4 = ($mUcs4 & 0x07) << 18;
74 }
else if (0xF8 == (0xFC & ($in))) {
84 $mUcs4 = ($mUcs4 & 0x03) << 24;
88 }
else if (0xFC == (0xFE & ($in))) {
91 $mUcs4 = ($mUcs4 & 1) << 30;
107 if (0x80 == (0xC0 & ($in))) {
110 $shift = ($mState - 1) * 6;
112 $tmp = ($tmp & 0x0000003F) << $shift;
119 if (0 == --$mState) {
125 if (((2 == $mBytes) && ($mUcs4 < 0x0080)) ||
126 ((3 == $mBytes) && ($mUcs4 < 0x0800)) ||
127 ((4 == $mBytes) && ($mUcs4 < 0x10000)) ||
130 (($mUcs4 & 0xFFFFF800) == 0xD800) ||
132 ($mUcs4 > 0x10FFFF)) {
176 if ( strlen($str) == 0 ) {
183 return (preg_match(
'/^.{1}/us',$str,$ar) == 1);