PHP 数字大小写转换?

2022-08-04 社会 57阅读

function daxie($number){
$number=substr($number,0,2);
$arr=array("零","一","二","三","四","五","六","七","八","九");
if(strlen($number)==1){
$result=$arr[$number];
}else{
if($number==10){
$result="十";
}else{
if($number<20){
$result="十";
}else{
$result=$arr[substr($number,0,1)]."十";
}
if(substr($number,1,1)!="0"){
$result.=$arr[substr($number,1,1)];
}
}
}
return $result."
";
}

echo daxie(7);
echo daxie(11);
?>

只能是两位的
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com