How to translate the decimal form of the amount into a Chinese form, say 1.1 ¥ translation into a round range?
reference:
Function Num2RMB ($ Num) {
$ C1 = "Zero Zibo Wei Lu Lu";
$ C2 = "Practitioner Pictures" and 100 million ";
$ Num = Round ($ NUM, 2);
$ Num = $ Num * 100;
IF (Strlen> 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;
}
}
$ j = 0;
$ SLEN = Strlen ($ C);
While ($ J <$ SLEN) {
$ M = Substr ($ C, $ J, 4);
IF ($ m == 'zero "| | $ m ==' 万 '| | $ m ==' 亿 '| | $ m ==' zero zero ') {
$ left = SUBSTR ($ C, 0, $ J);
$ Right = Substr ($ C, $ J 2);
$ C = $ left. $ 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);
}
Return $ c. "whole";
}
?>
$ out = Num2RMB (1.1);
Echo $ OUT;
?>