App\Http\Extensions\utf8_chinese_str::gb2312_big5 PHP Method

gb2312_big5() public method

public gb2312_big5 ( $str )
    public function gb2312_big5($str)
    {
        $str_t = '';
        $len = strlen($str);
        $a = 0;
        while ($a < $len) {
            if (ord($str[$a]) >= 224 && ord($str[$a]) <= 239) {
                if (($temp = strpos($this->utf8_gb2312, $str[$a] . $str[$a + 1] . $str[$a + 2])) !== false) {
                    $str_t .= $this->utf8_big5[$temp] . $this->utf8_big5[$temp + 1] . $this->utf8_big5[$temp + 2];
                    $a += 3;
                    continue;
                }
            }
            $str_t .= $str[$a];
            $a += 1;
        }
        return $str_t;
    }