Let's say I have numbers like
123456000000
12345000000
123456000
123456
and I want them to show up as
123.45B
12.345B
123.45M
123,456
The best way I can think of to do this is by getting string length to determine if I need a B, M, or nothing but commas and just substr the first five chars. I'm sure there is a better way though and I don't want to get too far before I realize that my idea sucks. hah.
Any good recommendations?
EDIT
My apologies on the confusion of the B and M. Those represent:
- B illion
- M illion
number_format()might be able to help. Also this comment on the same page us2.php.net/manual/en/function.number-format.php#89888