首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何在PHP中显示印度数字格式的货币?

如何在PHP中显示印度数字格式的货币?
EN

Stack Overflow用户
提问于 2012-04-06 18:51:42
回答 17查看 77.5K关注 0票数 34

我有一个关于格式化卢比货币(印度卢比-印度卢比)的问题。

例如,这里的数字表示为:

代码语言:javascript
运行
复制
1
10
100
1,000
10,000
1,00,000
10,00,000
1,00,00,000
10,00,00,000

参考Indian Numbering System

我不得不用PHP解决这个问题。

我已经看到了这个问题Displaying Currency in Indian Numbering Format。但是我的问题是不能在PHP中得到它。

更新:

如何在印度货币格式中使用money_format()

EN

Stack Overflow用户

发布于 2015-04-06 21:21:38

代码语言:javascript
运行
复制
$r=explode('.',12345601.20);

$n = $r[0];
$len = strlen($n); //lenght of the no
$num = substr($n,$len-3,3); //get the last 3 digits
$n = $n/1000; //omit the last 3 digits already stored in $num
while($n > 0) //loop the process - further get digits 2 by 2
{
    $len = strlen($n);
    $num = substr($n,$len-2,2).",".$num;
    $n = round($n/100);
}
echo "Rs.".$num.'.'.$r[1];
票数 0
EN
查看全部 17 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10042485

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档