在PHP中将数字(1,2,3)转换为字符串(一,二,三) [英] Converting a number (1, 2, 3) to a string (one, two, three) in PHP
本文介绍了在PHP中将数字(1,2,3)转换为字符串(一,二,三)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有人知道如何在PHP中将1,2或3等数字转换为文本版本(一,二,三)?我只需要从1转换为99.我知道我可以编写一个巨大的开关语句,但这将是荒谬的。
Does anyone know how to convert a number such as 1, 2, or 3 to their text version (one, two, three) in PHP? I only need to convert from 1 to 99. I know I could write a huge switch statement but that would be ridiculous.
推荐答案
pear有一个包 Numbers_Words :
$numberToWord = new Numbers_Words();
echo $numberToWords->toWords(200);
这篇关于在PHP中将数字(1,2,3)转换为字符串(一,二,三)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文