公告
财富商城
积分规则
提问
发文
2019-03-04 13:01发布
不美不萌又怎样
Is there any PHP function to convert an integer to Lakh and Crore?
integer
900800 -> 9,00,800 500800 -> 5,00,800
For most locales, use number_format: http://php.net/manual/en/function.number-format.php
number_format
For India (Lakh & Crore) use formatInIndianStyle provided in this comment: http://php.net/manual/en/function.number-format.php#40558
formatInIndianStyle
As you have added Yii in your question tags, you can do this in Yii's way like below:
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');
最多设置5个标签!
For most locales, use
number_format
: http://php.net/manual/en/function.number-format.phpFor India (Lakh & Crore) use
formatInIndianStyle
provided in this comment: http://php.net/manual/en/function.number-format.php#40558As you have added
Yii
in your question tags, you can do this inYii
's way like below: