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

PHP converts full-width numbers to half-width numbers

高洛峰
Release: 2016-11-29 15:49:11
Original
1068 people have browsed it

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
Copy after login


Related labels:
php
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