Code Snippets

PHP Format Numbers to Nearest Thousands

Here comes a function to to nearest thousands such as Kilos, Millions, Billions, and Trillions with comma. Function Output thousandsCurrencyFormat(3000); // 3k thousandsCurrencyFormat(35500); // 35.5k thousandsCurrencyFormat(905000); // 905k thousandsCurrencyFormat(5500000); // 5.5m thousandsCurrencyFormat(88800000); // 88.8m thousandsCurrencyFormat(745000000); // 745m thousandsCurrencyFormat(2000000000); // 2b thousandsCurrencyFormat(22200000000); // 22.2b thousandsCurrencyFormat(1000000000000); // 1t (1 .