How does php convert numbers to uppercase
This article mainly explains "how php converts numbers to uppercase". Interested friends may wish to take a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how php converts numbers to uppercase.
This article operating environment: Windows7 system, PHP7.1 version, DELL G3 computer
How to convert php numbers to uppercase? When we write the bill, we need to write the capitalization of the numerical amount. To be honest, we can't write it if we don't write it. In order to avoid embarrassing situations in the future, we specially practiced those ten words. Haha, of course, we can also convert it in php, so we have the following conversion function:
/ * lowercase to uppercase * @ param $ns int entered numbers * / function cny ($ns) {static $cnums = array ("zero", "one", "two", "three", "restaurant", "Wu", "Lu", "Qi", "Qing", "nine"), $cnyunits = array ("round", "corner", "cent"), $grees = array ("pick") "hundred", "thousand", "ten thousand", "pick up", "hundred", "thousand", "100 million") 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, $cnyunitss) 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;} so far, I believe you have a better understanding of "how php converts numbers to uppercase". Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!