php把全角数字转为半角数字 |
时间:2015-01-23 来源:西部数据 作者:西部数据 |
|
- 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];
- }
- return $fnum;
- }
-
- echo getalabnum('6');
|
|
|
|