<?php
//****人民币大小写转换格式****
function ChangeToRMB($Val)
{
$str=array();
$str[0]="零";
$str[1]="壹";
$str[2]="贰";
$str[3]="叁";
$str[4]="肆";
$str[5]="伍";
$str[6]="陆";
$str[7]="柒";
$str[8]="捌";
$str[9]="玖";
$oldval=$Val;
$Val=str_replace(",","",$Val);
$Val=number_format($Val,2);
$Val=str_replace(".","",$Val);
$Val=str_replace(",","",$Val);
$f=$Val;
$Val=abs($Val);
if($f!=$Val)$m="负";
for ($i=1 ;$i<= strlen($Val);$i++)
{
$mynum=substr($Val,$i-1,1);
switch (strlen($Val)+1-$i)
{
case 1:
$k= $mynum."分";
break;
case 2:
$k= $mynum."角";
break;
case 3:
$k= $mynum."元";
break;
case 4:
$k= $mynum."拾";
break;
case 5:
$k= $mynum."佰";
break;
case 6:
$k= $mynum."仟";
break;
case 7:
$k= $mynum."万";
break;
case 8:
$k= $mynum."拾";
break;
case 9:
$k= $mynum."佰";
break;
case 10:
$k= $mynum."仟";
break;
case 11 :
$k= $mynum."亿";
break;
case 12 :
$k= $mynum."拾";
break;
case 13:
$k= $mynum."佰";
break;
case 14:
$k= $mynum."仟";
break;
}
$m .=$k;
}
foreach($str as $key=>$val)
{
$m=str_replace($key,$val,$m);
}
return $m;
}
?>