Home > Backend Development > PHP Tutorial > Convert full-width numbers to half-width numbers

Convert full-width numbers to half-width numbers

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-25 09:10:09
Original
1248 people have browsed it
Convert full-width numbers to half-width numbers
  1. //Convert full-width numbers to half-width numbers
  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<= 9;$i++) $fnum = str_replace($nums[$i],$fnums[$i],$fnum); //OsPHP.COM.CN
  7. $fnum = ereg_replace("[^0-9.]| ^0{1,}","",$fnum);
  8. if($fnum=="") $fnum=0;
  9. return $fnum;
  10. }
  11. ?>
Copy code


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template