Shorten Long/Large Numbers using PHP
Submitted by Jeprox on Thursday, December 24, 2015 - 11:24.
Language
Good Day. In this project we are going learn how to shorten long numbers to K/ M/ B/ T/q/Q/s/S/O/N/d.
This function abbreviates a large number it display numbers like 3.5K and 4.2M.
- thousandsCurrencyFormat(1000) - 1k (One Thousand)
- thousandsCurrencyFormat(1000000) - 1M (One Million)
- thousandsCurrencyFormat(1000000000) - 1B (One Billion)
- thousandsCurrencyFormat(1000000000000) - 1T (One Trillion)
- thousandsCurrencyFormat(1000000000000000) - 1q (One Quadrillion)
- thousandsCurrencyFormat(1000000000000000000) - 1Q (One Quintillion)
- thousandsCurrencyFormat(1000000000000000000000) - 1s (One Sextillion)
- thousandsCurrencyFormat(1000000000000000000000000) - 1S (One Septillion)
- thousandsCurrencyFormat(1000000000000000000000000000) - 1O (One Octillion)
- thousandsCurrencyFormat(1000000000000000000000000000000) - 1N (One Nonillion)
- thousandsCurrencyFormat(1000000000000000000000000000000000) - 1d (One Decillion)
PHP Number Abbreviator
Description
Symbol
Number
Result
Trillion
T
7,300,000,000,000
Billion
B
9,000,000,000
Million
M
12,000,000
Thousand
K
588,000
Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.
Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.
FOR YOUR OWN SAFETY, PLEASE:
1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
Add new comment
- 253 views