把全角数字转为半角数字

作者:袖梨 2022-11-14

//

代码如下 复制代码
function getalabnum($fnum)
{
$nums = array("0","1","2","3","4","5","6","7","8","9","+","-","%",".");
$fnums = "0123456789+-%.";
for($i=0;$i if($nums[$i]==$fnum) return $fnums[$i];
}
return $fnum;
}



//实例应用

代码如下 复制代码
echo getalabnum('6'); // 6

相关文章

精彩推荐