The array amount is converted to uppercase
/*** Function for converting the numeric amount to the Chinese capital amount * String Int $ num the lowercase number to be converted or the lowercase String * return uppercase letter * **/function num_to_ RMB ($ num) {$ c1 = ""; $ c2 = ""; // no more accurate to the end of the minute, so leave only two decimal places $ num = round ($ num, 2); // Convert the number to an integer $ num = $ num * 100; if (strlen ($ num)> 10) {return "The amount is too large. Please check" ;}$ I = 0; $ c = ""; while (1) {if ($ I = 0) {// Obtain the last digit $ n = substr ($ num, strlen ($ num)-1, 1);} else {$ n = $ num % 10 ;} // Convert the last digit to Chinese every time. $ P1 = substr ($ c1, 3 * $ n, 3); $ p2 = substr ($ c2, 3 * $ I, 3); if ($ n! = '0' | ($ n = '0' & ($ p2 = '000000' | $ p2 = '000000' | $ p2 =' yuan '))) {$ c = $ p1. $ p2. $ c;} else {$ c = $ p1. $ c;} $ I = $ I + 1; // remove the last digit from the number $ num = $ num/10; $ num = (int) $ num; // end loop if ($ num = 0) {break ;}}$ j = 0; $ slen = strlen ($ c); while ($ j <$ slen) {// utf8 a Chinese character is equivalent to 3 characters $ m = substr ($ c, $ j, 6); // process many numbers with 0 values, remove a Chinese character "zero" if ($ m = 'zero meta' | $ m = '000000' | $ m = '000000' | $ m = 'zero ID ') {$ left = substr ($ c, 0, $ j); $ right = substr ($ c, $ j + 3); $ c = $ left. $ right; $ j = $ J-3; $ slen = $ slen-3;} $ j = $ j + 3 ;} // This is to remove the last "zero" word like 23.0 if (substr ($ c, strlen ($ c)-3, 3) = '0 ') {$ c = substr ($ c, 0, strlen ($ c)-3);} // add the processed Chinese characters to an integer if (empty ($ c )) {return "zero yuan";} else {return $ c. "whole" ;}} echo num_to_ RMB (4562845.56 );