function exchange($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 exchange(1);
echo exchange(11);
echo exchange(21);
?>
这个可以转换两位。只是给楼主一个思路。授之以鱼不如授之以渔。
希望能给楼主帮助