中国語|変換
// Zhuhaijia
// 2000-7-19
class ChineseNumber
{
var $basical=array(0=>"zero","one","two","three" ," four","five","six","seven","eight","nine");
//var $basical=array(0=>"zero","one","two" ,"三","四","五","鲁","撒","八","九");
var $advanced=array(1=>"十","百","千" );
//var $advanced=array(1=>"十","百","仟");
var $top=array(1=>"10,000","1億"); // は数千億件しか処理できません。 "Return" 数値が大きすぎるため処理できません。 ";
IF ($ Number == 0)
Return" ゼロ ";
for ($ this- & gt; level = 0; $number & gt ; 0.0001;分 // 4 つの変数は、1、10、100、1000 に対応します。 $ n1 = substr($ number、-1,1); > advanced [3]; this->level]) && ($number / 1000)>=1) // 2 つ連続する「ゼロ」はありません
if($n2)
$parsed[$this->level].=$this->basical[$n2].$this->advanced[1];
else
if(!ereg("零$ ",$parsed[$this->level]) && ($number / 100)>=1) // 不出现连续两个“零”的情况
$parsed[$this->level].= "零";
if($n1)
$parsed[$this->level].=$this->basical[$n1];
}
for($this->level-=1;$ this->level>=0;$this->level--)
{
$result.=$parsed[$this->level].$this->top[$this->level] ;
}
if(ereg("零$",$result))
$result=substr($result,0,strlen($result)-2);
return $result;
}
};
$c=new ChineseNumber();
echo $c->ParseNumber(123456789012);
?>