Alex Rivera | Logout

How do I display Currency in Indian Numbering Format in PHP?

Asked 2012-04-06T10:51:42.140
40

I have a question about formatting the Rupee currency (Indian Rupee - INR).

For example, numbers here are represented as:

1
10
100
1,000
10,000
1,00,000
10,00,000
1,00,00,000
10,00,00,000

Refer Indian Numbering System

I have to do with it PHP.

I have seen this question Displaying Currency in Indian Numbering Format, but couldn't find an answer for PHP.

Update:

How do I use money_format() in indian currency format?

Edit
Report

1 Answer

1

I have used different format parameters to money_format() for my output.

setlocale(LC_MONETARY, 'en_IN');
if (ctype_digit($amount) ) {
     // is whole number
     // if not required any numbers after decimal use this format 
     $amount = money_format('%!.0n', $amount);
}
else {
     // is not whole number
     $amount = money_format('%!i', $amount);
}
//$amount=10043445.7887 outputs 1,00,43,445.79
//$amount=10043445 outputs 1,00,43,445
answered 2012-04-07T09:08:57.017

Your Answer