Convert a value (less than billion RMB) to an upper-case RMB rt: convert a value (less than billion RMB) to an upper-case RMB. PHP is used for this purpose. PHPer quick AH, http://www.phparticipant le.net/htmldata/2268/1/,phpcode< ;? Error_reporting (2047); # report all invalid errors ob_star converts the value (below billion RMB) into uppercase RMB
Rt: converts a value (less than billion RMB) to an upper-case RMB. PHP is used for this purpose. PHPer fast
------ Solution --------------------
Http://www.phparticle.net/htmldata/2268/1/
------ Solution --------------------
PHP code
Pow () return "The amount must be less than billion"; $ re = ''; $ arr1 = array ('0', 'yi', 'er', 'san ', 'ta', 'wu', 'Lu', 'region'); $ arr2 = array ('meta', 'pick ', 'Taobao', 'Taobao', 'wan', 'Taobao', 'Taobao', 'yie', 'Taobao', 'Taobao ', 'quantity'); $ arr3 = array ('angular ', 'quantity', 'pct', 'Milli '); $ pre1 = count ($ arr2 ); # precision in units $ pre2 = count ($ arr3); # precision in decimal places $ arr = @ explode (". ", $ RMB); # cut by decimal point $ len1 = @ strlen ($ arr [0]); # integer length $ len2 = @ strlen ($ arr [1]); # decimal scale length for ($ I = 0; $ I <$ len1 & $ I <$ pr E1; $ I ++) {$ bit = $ arr [0] [$ len1-$ i-1]; # Current lowercase amount $ cn = $ arr1 [$ bit]; # Current bit capital amount $ unit = $ arr2 [$ I]; # Current bit amount unit # case where the lowercase amount is zero if ($ bit = 0) {if (ereg ('RMB |', $ unit) $ re = $ unit. $ re; else $ re = $ cn. $ re ;}# else {$ re = $ cn. $ unit. $ re ;}}for ($ I = 0; $ I <count ($ arr3) & $ I <$ len2; $ I ++) {$ bit = $ arr [1] [$ I]; # The current lowercase amount $ cn = $ arr1 [$ bit]; # Current bit capital amount $ unit = $ arr3 [$ I]; # Current bit amount unit if ($ bit! = 0) $ re. = $ cn. $ unit; elseif ($ I <2) $ re. = "0";} if ($ Format) {# Format the lower-case amount # exact number of digits. Decimal places not less than 2, not greater than the maximum precision $ gage = min (max (2, $ len2), $ pre2); $ GLOBALS [$ Format] = number_format ($ RMB, $ gage ,". ",", ") ;}$ re = preg_replace (array ("//","/(0) $/","/(0) {2 ,} /"), array (" "," "," zero "), $ re); # replace the regular expression if (! $ Len2) $ re. = "integral"; # Add "integral" return $ re ;} /// // RMB ('20140901 '); $ money = isset ($ _ GET ['Money'])? $ _ GET ['Money']: ""; $ RMB = RMB ($ money, "money");?>