Here comes a PHP function to format numbers to nearest thousands such as Kilos, Millions, Billions, and Trillions with comma.



 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 trillion)

Leave a Reply

Your email address will not be published. Required fields are marked *