欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

php代码把全角数字转为半角数字_PHP教程

程序员文章站 2022-06-05 23:03:34
...
//把全角数字转为半角数字
function GetAlabNum($fnum){
$nums = array('0','1','2','3','4','5','6','7','8','9','.','-','+',':');
$fnums = array('0','1', '2','3', '4','5', '6', '7','8', '9','.', '-', '+',':');
$fnlen = count($fnums);
for($i=0;$i $slen = strlen($fnum);
$oknum = '';
for($i=0;$i if(ord($fnum[$i]) > 0x80) $i++;
else $oknum .= $fnum[$i];
}
if($oknum=="") $oknum=0;
return $oknum;
}

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/318569.htmlTechArticle//把全角数字转为半角数字 functionGetAlabNum($fnum){ $nums=array('0','1','2','3','4','5','6','7','8','9','.','-','+',':'); $fnums=array('0','1'...