Home >php教程 >php手册 >阿拉伯数字转中文数字

阿拉伯数字转中文数字

WBOY
WBOYOriginal
2016-06-07 11:45:371695browse

阿拉伯数字转中文数字
function ToChinaseNum($num)<br> {<br>     $char = array("零","一","二","三","四","五","六","七","八","九");<br>     $dw = array("","十","百","千","万","亿","兆");<br>     $retval = "";<br>     $proZero = false;<br>     for($i = 0;$i      {<br>         if($i > 0)    $temp = (int)(($num % pow (10,$i+1)) / pow (10,$i));<br>         else $temp = (int)($num % pow (10,1));<br>         <br>         if($proZero == true && $temp == 0) continue;<br>         <br>         if($temp == 0) $proZero = true;<br>         else $proZero = false;<br>         <br>         if($proZero)<br>         {<br>             if($retval == "") continue;<br>             $retval = $char[$temp].$retval;<br>         }<br>         else $retval = $char[$temp].$dw[$i].$retval;<br>     }<br>     if($retval == "一十") $retval = "十";<br>     return $retval;<br> }

AD:真正免费,域名+虚机+企业邮箱=0元

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn