是否有任何PHP函数将数字转换为具有数千个分隔符的货币?

是否有任何PHP函数将integer转换为Lakh和Crore?

 900800 -> 9,00,800 500800 -> 5,00,800 

正如您在问号中添加了Yii ,您可以使用Yii的方式执行此操作,如下所示:

 Yii::app()->language='en_IN'; // Output: Lakh 9,00,800 echo Yii::app()->numberFormatter->formatCurrency('900800', 'Lakh'); // Output: ₹ 5,00,800 echo Yii::app()->numberFormatter->formatCurrency('500800', 'INR'); 

对于大多数语言环境,请使用number_format : http : //php.net/manual/en/function.number-format.php

对于印度(Lakh&Crore),请使用此评论中提供的formatInIndianStyle : http : formatInIndianStyle