I am looking to have a script that can convert numbers like 1,123,000,567 to something like 1.23B. I will need this script to cover
K=thousands,
M=Millions,
B=Billions,
T=Trillions,
Q=quadrillions,
U=quintillion
S=sextillion
PHP Number Conversions
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Well, your blocks would indicate that it won't be a native number, so a simple floor((strlen($foo) + 3) / 4) will tell you which notch it falls in, then a substr() can perform the last bit.