RMB Digital to Chinese capital, is a more common demand, so here to share a function, also counted as a record, in case you will use later!
function Num2rmb ($num) {$c 1 = "0 One and three Woolu qi Ba Jiu"; $c 2 = "split-angle element pick Bai thousand thousand million"; $num = Round ($num, 2); $num = $num * 100; if (strlen ($num) >) {return "oh,sorry,the number is too long!"; } $i = 0; $c = ""; while (1) {if ($i = = 0) {$n = substr ($num, strlen ($num)-1, 1); } else {$n = $num% 10; } $p 1 = substr ($c 1, 3 * $n, 3); $p 2 = substr ($c 2, 3 * $i, 3); if ($n! = ' 0 ' | | ($n = = ' 0 ' && ($p 2 = = ' billion ' | | $p 2 = = ' million ' | | $p 2 = = ' Yuan '))) {$c = $p 1. $p 2. $c; } else {$c = $p 1. $c; } $i = $i + 1; $num = $num/10; $num = (int) $num; if ($num = = 0) {break; }} $j = 0; $slen = strlen ($c); while ($j < $slen) {$m = substr ($c, $j, 6); if ($m = = ' 0 Yuan ' | | $m = = ' 0 ' | | $m = = ' 0 ' | | $m = = ' 00 ') {$left = substr ($c, 0, $j); $right = substr ($c, $j + 3); $c = $Left. $right; $j = $j-3; $slen = $slen-3; } $j = $j + 3; } if (substr ($c, strlen ($c)-3, 3) = = ' 0 ') {$c = substr ($c, 0, strlen ($c)-3); }//If there is a ' 0 ' on the end, chop it out return $c. "Whole";}