In our daily development work, we often encounter the conversion of RMB amounts. The conversion of RMB is essential in many places, such as payment on major websites, bank transfers, etc. RMB is in capital letters instead of Arabic numerals, so we have to convert the numbers into Chinese capital letters. Today I will introduce to you how to achieve it~
The first step is to download the high-level tools we need to use for this course. Efficient RMB amount to uppercase program php class library: http://www.php.cn/xiazai/leiku/795
The second step is to find the php we need after the download is complete Class file, compress it to a local directory, create a new php file~
The third step, after the creation is completed, we call the class in the new file and instantiate this class:
<?php include_once "codermb.php"; //引入类文件 $obj = new Ext_Num2Cny; //实例化此类 $number = "123456789"; //定义数字 //输出转换内容 echo $obj->ParseNumber($number)."<br>"; echo $obj->int($number)."<br>"; echo $obj->dec($number)."<br>"; ?>
The result of running this file is as shown below:
The above is the detailed content of Example development of a program to realize high-efficiency conversion of RMB amounts to uppercase letters in PHP. For more information, please follow other related articles on the PHP Chinese website!