Home >php教程 >PHP源码 >php gb2312转big5 函数

php gb2312转big5 函数

PHP中文网
PHP中文网Original
2016-05-25 17:09:391127browse

[PHP]代码 

function GB2312toBIG5($c) {
$f = fopen(CODETABLE_DIR.$this->config['GBtoBIG5_table'], ‘r’);
$max=strlen($c)-1;
for($i = 0;$i < $max;$i++){ $h=ord($c[$i]); if($h>=160) {
$l=ord($c[$i+1]);
if($h==161 && $l==64){
$gb=” “;
} else{
fseek($f,($h-160)*510+($l-1)*2);
$gb=fread($f,2);
}
$c[$i]=$gb[0];
$c[$i+1]=$gb[1];
$i++;
}
}
$result = $c;
return $result;
}

                   

                   

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:自己写的php压力测试工具Next article:采集网站资源