Implementing digital amount to Chinese uppercase characters in PHP

zhaozj2021-02-16  48

In the process of developing a PHP application, it is often encountered to convert the digital amount to the uppercase Chinese characters. This thought that there must be a good PHP function on the Internet. But I found it, I didn't find it. Helpless, I have to do myself. Now take it out and share it with you. I hope that I can change the history of "finding".

10) {Return "OH, Sorry, The Number IS TOON!"; } $ I = 0; $ c = ""; while (1) {IF ($ i == 0) {$ n = substr ($ NUM, STRLEN ($ Num) -1, 1);} else {$ n = $ Num% 10;} $ p1 = substr ($ C1, 2 * $ N, 2); $ P2 = SUBSTR ($ C2, 2 * $ I, 2); if ($ N! = '0' || ($ n == '0' && ($ P2 ==0 million || $ P2 == '10)) {$ c = $ p1. $ p2. $ c Else {$ C = $ P1. $ C;} $ i = $ i 1; $ Num = $ Num / 10; $ Num = (int) $ NUM; if ($ Num == 0) {Break; }}}}} // end of while | here J <$ m = substr ($ C, $ J, 4); if ($ m == 'zero "|| $ m ==' 万 '|| $ m ==' 亿 ' || $ m == 'zero') {$ left = substr ($ C, 0, $ J); $ Right = Substr ($ C, $ J 2); $ c = $ l r $ right; $ j = $ j-2; $ slen = $ slen-2;} $ j = $ j 2;} if (SubStr ($ C, Strlen ($ C) -2, 2) == 'zero') {$ C = SUBSTR ($ C, 0, Strlen ($ C) -2);} // if there is a ' 0 'on the end, chop it out return $ c. "Whole";} // end of function?>

$ out = Num2RMB (1001.4570); Echo $ out;?>

What is good? Please contact me (cyman20@sina.com).

转载请注明原文地址:https://www.9cbs.com/read-27956.html

New Post(0)