金額の換算に使いたい場合は、小数部の処理を修正する必要があります
function ch_num($num,$mode=true) {
$char = array("zero") ,"壹", "二","三","四","五","鲁","七","八","九");
$dw = array("","十"); ,"百", "仟","","万","十億","兆");
$dec = "ポイント"
if($mode)
preg_match_all( "/^0* (d*).?(d*)/",$num, $ar);
else
preg_match_all("/(d*).?(d*)/",$num, $ar); );
if ($ar[2][0] != "")
$retval = $dec . ch_num($ar[2][0],false); //小数点がある場合は小数点を処理します。再帰的に最初に
if($ar [1][0] != "") {
$str = strrev($ar[1][0])
for($i=0;$i
if($mode) {
$out[$i] .= $str[$i] != " 0"? $dw[$ i%4] : "";
if($str[$i]+$str[$i-1] == 0)
$out[$i] = "";
if ($i%4 == 0)
$out[$i] .= $dw[4+floor($i/4)]
}
}
$retval = join("",array_reverse($out); ) . $retval;
return $retval;
//echo ch_num("880079.1234"); 0123");
?> ;
http://www.bkjia.com/PHPjc/319217.html