首页  >  文章  >  后端开发  >  PHP把全角数字转为半角数字

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

WBOY
WBOY原创
2016-07-25 08:44:28805浏览
  1. //把全角数字转为半角数字
  2. function GetAlabNum($fnum){
  3. $nums = array("0","1","2","3","4","5","6","7","8","9");
  4. //OSPHP.com.CN
  5. $fnums = "0123456789";
  6. for($i=0;$i$fnum = ereg_replace("[^0-9.]|^0{1,}","",$fnum);
  7. if($fnum=="") $fnum=0;
  8. return $fnum;
  9. }
  10. ?>
复制代码

PHP


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