首页 >后端开发 >php教程 >php把全角数字转为半角数字

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

高洛峰
高洛峰原创
2016-11-29 15:49:111068浏览

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(&#39;6&#39;); // 6


声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn