What is Short Number
Short Number is a lightweight, multilingual PHP library for formatting numbers into short, human-readable, compact abbreviations. It can format large numbers into short strings like 1k, 1m, 1b, 1t, 1q, 1qi depending on the language and the number.
Advantages of Short Number
Short Number is focused on providing the best performance and the most accurate number formatting. Here are some of the advantages of using Short Number:
🚀 Fast execution
Written to make number parsing as fast as possible
🌍 Multilingual support
Supports multiple languages and can format numbers in different languages
📦 Lightweight
Has no external dependencies and is very lightweight
🪶 Low memory usage
Loads only needed data into memory when parsing the input
📃 Well documented
Has a simple and easy-to-use API with decent docs
Largest Supported Number
Every PHP int is supported, up to PHP_INT_MAX (9,223,372,036,854,775,807) or 9.223 × 10¹⁸.
Supported Languages
| Language | Code | Thousand | Million | Billion | Trillion | Quadrillion | Quintillion | |
|---|---|---|---|---|---|---|---|---|
| 🇬🇧 | English | en | 1k | 1m | 1b | 1t | 1q | 1qi |
| 🇷🇺 | Russian | ru | 1тыс | 1млн | 1млрд | 1трлн | 1квадр | 1квинт |
| 🇺🇦 | Ukrainian | uk | 1тис | 1млн | 1млрд | 1трлн | 1квадр | 1квинт |
| 🇨🇳 | Chinese | zh | 1000 | 100万 | 10亿 | 1万亿 | 1000万亿 | 1000000万亿 |
| 🇯🇵 | Japanese | ja | 1000 | 100万 | 10億 | 1兆 | 1000兆 | 100京 |
Different Counting Systems
Large numbers in languages like Chinese and Japanese are often abbreviated using unique counting systems based on units of 10,000 and 100,000,000. This library accounts for those systems when formatting numbers.
