Welcome to the Linux community forum and interact with 2 million technical staff to go to PHP to convert the RMB amount to Chinese capital :? Phpheader (Content-Type: texthtml; charsetutf-8); error_reporting (2); functioncny ($ ns) {static $ cnumsarray (zero, one, two, three, Si, Wu
Welcome to the Linux community forum and interact with 2 million technical staff> go to PHP to convert the RMB amount to Chinese capital :? Php header ("Content-Type: text/html; charset = UTF-8"); error_reporting (2); function cny ($ ns) {static $ cnums = array ("0 ", "Yi", "er", "San", "Si", "Wu"
Welcome to the Linux community forum and interact with 2 million technicians>
PHP converts RMB into Chinese capital:
Header ("Content-Type: text/html; charset = UTF-8 ");
Error_reporting (2 );
Function cny ($ ns ){
Static $ cnums = array ("zero", "one", "two", "three", "Si", "Wu", "Lu", "Lu ", "success", "fail "),
$ Cnyunits = array ("circle", "Corner", "Minute "),
$ Grees = array ("pick", "weight", "weight", "", "Pick", "weight", "weight ");
List ($ ns1, $ NS2.) = explode (".", $ ns, 2 );
$ NS2. = array_filter (array ($ ns2 [1], $ ns2 [0]);
$ Ret = array_merge ($ NS2. array (implode ("", _ cny_map_unit (str_split ($ ns1), $ grees )),""));
$ Ret = implode ("", array_reverse (_ cny_map_unit ($ ret, $ cnyunits )));
Return str_replace (array_keys ($ cnums), $ cnums, $ ret );
}
Function _ cny_map_unit ($ list, $ units ){
$ Ul = count ($ units );
$ Xs = array ();
Foreach (array_reverse ($ list) as $ x ){
$ L = count ($ xs );
If ($ x! = "0" |! ($ L % 4) $ n = ($ x = '0 '? '': $ X ). ($ Units [($ L-1) % $ ul]);
Else $ n = is_numeric ($ xs [0] [0])? $ X :'';
Array_unshift ($ xs, $ n );
}
Return $ xs;
}
Echo cny ('000000 ');
?>