PHP Format numbers to Indian Numerical System

By | July 1, 2009

The numerical system used in India differs from the Western system in terms of the placement of the thousands separator.

Example :
Number -> 1000000
Indian System -> 10,00,000 (Ten Lakh)
Western System -> 1,000,000 (1 Million)

While echoing numbers in PHP it is possible to format numbers with such separators using functions like number_format.

To format a number in the Indian Numerical System the code would be :

$amount = '100000';
setlocale(LC_MONETARY, 'en_IN');
$amount = money_format('%!i', $amount);
echo $amount;

and the output should be :


1. Set the locale.
2. Format the number using money_format.

About Silver Moon

A Tech Enthusiast, Blogger, Linux Fan and a Software Developer. Writes about Computer hardware, Linux and Open Source software and coding in Python, Php and Javascript. He can be reached at [email protected].


PHP Format numbers to Indian Numerical System
  1. matheen

    Thanks… It works as per my requirement….

    I have done some modification to remove the decimal points.

    $number = 10000;
    setlocale(LC_MONETARY, ‘en_IN’); $amount1 = money_format(‘%!.0n’, $number); echo $amount1;

Leave a Reply

Your email address will not be published. Required fields are marked *