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

php把全角数字转为半角数字

程序员文章站 2022-05-17 15:30:16
...
function getalabnum($fnum) 
{ 
 $nums = array("0","1","2","3","4","5","6","7","8","9","+","-","%","."); 
 $fnums = "0123456789+-%."; 
 for($i=0;$i<count($nums);$i++){ 
  if($nums[$i]==$fnum) return $fnums[$i]; 
 }//开源代码phpfensi.com 
 return $fnum; 
} 
//实例应用 
echo getalabnum('6'); // 6
相关标签: php