tags:

views:

48

answers:

1

I was wondering if there is any php function to convert the number of 1000 to 1,000.00, 10000 to 10,000.00 and so on . I can write a regex but I just want to know if there is any php build in function like floor .

+6  A: 

see http://docs.php.net/number_format

for($e=1; $e<9; $e++) {
  echo number_format(pow(10,$e) , 2), "\n";
}

prints

10.00
100.00
1,000.00
10,000.00
100,000.00
1,000,000.00
10,000,000.00
100,000,000.00
VolkerK