PHP: Format a numeric string by inserting comma

Posted by gameover on Stack Overflow See other posts from Stack Overflow or by gameover
Published on 2010-03-13T03:42:31Z Indexed on 2010/04/08 6:43 UTC
Read the original article Hit count: 321

I need a way to convert a number into formatted way by inserting comma at suitable places. Can it be done using regex?

Example:

12345 => 12,345
1234567 =>1,234,567

© Stack Overflow or respective owner

Related posts about regex

Related posts about php