/** * @return all UTF8 characters of $s EXCEPT FOR if they are within special ranges (Chinese characters) */ static function noChineseChars($s, $enc = 'UTF-8') { $retval = ''; $len = mb_strlen($s); for ($i = 0; $i < $len; $i++) { $c = mb_substr($s, $i, 1, $enc); $code = FX::mbOrd($c); if ($code >= 0x4e00 && $code <= 0x9fff) { continue; } elseif ($code >= 0x4e00 && $code <= 0x9fff) { continue; } elseif ($code >= 0x3400 && $code <= 0x4dff) { continue; } elseif ($code >= 0x20000 && $code <= 0x2a6df) { continue; } elseif ($code >= 0x2f800 && $code <= 0x2fa1f) { continue; } $retval .= $c; } return $retval; }