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

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

程序员文章站 2022-05-27 15:39:43
...
  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