【发布时间】:2012-02-04 22:02:22
【问题描述】:
可能重复:
Is there an easy way to convert a number to a word in PHP?
最近我需要将一个数字更改为字符串,就像下面的 php 中一样
$str=100;
{ Here will be the code which will return One Hundred not 100}
所以 $str=150 然后将返回 150
我该怎么做。如何将数字更改为 php 中的文本(NB: 数字将是随机的) 请帮帮我
【问题讨论】:
-
你有没有尝试过,或者你只是想让别人为你编码?
-
呃,作业?无论如何:
$expontents = array( 1000000000 => 'billion', 1000000 = 'million', 1000 => 'thousand', 100 => 'hundred'); $decades = array( 10 => 'ten', 20 => 'twenty'), $numbers = array( 'zero', 'one', 'two'), $specials => array( 11 => 'eleven')和%<>+-*/, floor是要走的路:)
标签: php