Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/240.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 smarty中的数字格式_Php_Smarty_Number Formatting - Fatal编程技术网

Php smarty中的数字格式

Php smarty中的数字格式,php,smarty,number-formatting,Php,Smarty,Number Formatting,如何在smarty中将我的价格(200000分为2个LAC,20000000=>2个Crore)显示为十进制值 我将价格值存储为 200000 350000 2000000 20000000 2/2.00 Lacs 3.5 lacs 20/20.00 lacs 2/2.00 crore 在MySQL中,现在我需要将这个值显示为 200000 350000 2000000 20000000 2/2.00 Lacs 3.5 lacs 20/20.00 lacs 2/2.00 crore

如何在smarty中将我的价格(
200000分为2个LAC,20000000=>2个Crore
)显示为十进制值

我将价格值存储为

200000
350000
2000000
20000000
2/2.00 Lacs 
3.5 lacs 
20/20.00 lacs
2/2.00 crore
在MySQL中,现在我需要将这个值显示为

200000
350000
2000000
20000000
2/2.00 Lacs 
3.5 lacs 
20/20.00 lacs
2/2.00 crore
可能重复的问题是


谢谢。

棘手的一点是如何处理印度货币格式,这一点已在中介绍。之后,添加一个允许您在模板中编写如下内容的

{$amount|format_indian_currency}

棘手的一点是处理印度货币的格式,这在本文中有介绍。之后,添加一个允许您在模板中编写如下内容的

{$amount|format_indian_currency}
我同意罗布·阿加尔的观点

我不确定你的数字,但像这样的自定义修改器是一个起点

function smarty_modifier_indian_currency($price)
{
    if($price>100000)
    {
        $lacs=$price/100000;
        // lacs

        if($lacs<100) return $lacs.' lacs';

        $crore=floor($lacs/100);
        $lacs=$lacs-($crore*100);

        if($lacs==0) return $crore.' crore';
        return $crore.'/'.$lacs.' crore';

    }
    return $price;
}
函数智能修改器印度货币($price)
{
如果($price>100000)
{
$lacs=$price/100000;
//lacs
如果($lacs我同意Rob Agar的观点

我不确定你的数字,但像这样的自定义修改器是一个起点

function smarty_modifier_indian_currency($price)
{
    if($price>100000)
    {
        $lacs=$price/100000;
        // lacs

        if($lacs<100) return $lacs.' lacs';

        $crore=floor($lacs/100);
        $lacs=$lacs-($crore*100);

        if($lacs==0) return $crore.' crore';
        return $crore.'/'.$lacs.' crore';

    }
    return $price;
}
函数智能修改器印度货币($price)
{
如果($price>100000)
{
$lacs=$price/100000;
//lacs
如果($lacs)