Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/253.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何将数字更改为字符串_Php - Fatal编程技术网

Php 如何将数字更改为字符串

Php 如何将数字更改为字符串,php,Php,可能重复: 最近,我需要将一个数字更改为字符串,就像下面在php中一样 $str=100; { Here will be the code which will return One Hundred not 100} 因此,$str=150然后将返回150 我该怎么做呢。如何在php中将数字更改为文本(NB:数字将是随机的) 请帮我用梨包装 例如 require('Numbers/Words.php'); $number = 150; $nw = new Numbers_Words(

可能重复:

最近,我需要将一个数字更改为字符串,就像下面在php中一样

$str=100;

{ Here will be the code which will return One Hundred not 100}
因此,$str=150然后将返回150

我该怎么做呢。如何在php中将数字更改为文本(NB:数字将是随机的) 请帮我用梨包装

例如

 require('Numbers/Words.php');
 $number = 150;
 $nw = new Numbers_Words();
 $numw = $nw->toWords($number);

 echo $numw; //one hundred fifty
用梨包装

例如

 require('Numbers/Words.php');
 $number = 150;
 $nw = new Numbers_Words();
 $numw = $nw->toWords($number);

 echo $numw; //one hundred fifty

此问题的解决方案已在以下位置的php文档评论中提出:


希望对您有所帮助

以下位置的php文档评论中已建议了此问题的解决方案:


希望对你有所帮助有一个PEAR软件包可以帮你


有一个PEAR软件包可以帮你完成这项工作


你试过什么吗,还是你只是想让别人帮你编码?啊,家庭作业?无论如何:
$expontents=array(1000000000=>'十亿',1000000='百万',1000=>'000',100=>'100')$十年=数组(10=>‘十’、20=>‘二十’、$numbers=数组(‘零’、‘一’、‘二’)、$specials=>数组(11=>‘十一’)
%+-*/,floor
很好:)你试过什么了吗,还是想让别人帮你编码?啊,家庭作业?无论如何:
$expontents=array(1000000000=>'十亿',1000000='百万',1000=>'000',100=>'100')$十年=数组(10=>'10',20=>'20'),$numbers=数组('0','1','2'),$specials=>数组(11=>'11')
%+-*/,floor
很好:)有人尝试过大于99999999(十亿及以上)的数字吗?100000000表示“一百万”!?是否有人尝试过大于99999999(十亿及以上)的数字?100000000表示“一百万”!?