<!DOCTYPE html> <html lang="eng"> <head> <title>PHP Number Abbreviator</title> </head> <body> <?php function thousandsCurrencyFormat($num) { $x = round($num); $x_number_format = number_format($x); $x_array = explode(',', $x_number_format); $x_parts = array('k', 'M', 'B', 'T', 'q', 'Q', 's', 'S', 'O', 'N', 'd'); $x_count_parts = count($x_array) - 1; $x_display = $x; $x_display = $x_array[0] . ((int) $x_array[1][0] !== 0 ? '.' . $x_array[1][0] : ''); $x_display .= $x_parts[$x_count_parts - 1]; return $x_display; } ?> <table cellpadding="15" cellspacing="5" border="1"> <thead> <tr> <th>Description</th> <th>Symbol</th> <th>Number</th> <th>Result</th> </tr> </thead> <tbody> <tr> <td style="text-align:center;">Trillion</td> <td style="text-align:center;">T</td> <td style="text-align:center;">7,300,000,000,000</td> <td style="text-align:center;"><?php echo thousandsCurrencyFormat(7300000000000)?></td> </tr> <tr> <td style="text-align:center;">Billion</td> <td style="text-align:center;">B</td> <td style="text-align:center;">9,000,000,000</td> <td style="text-align:center;"><?php echo thousandsCurrencyFormat(9000000000)?></td> </tr> <tr> <td style="text-align:center;">Million</td> <td style="text-align:center;">M</td> <td style="text-align:center;">12,000,000</td> <td style="text-align:center;"><?php echo thousandsCurrencyFormat(12000000)?></td> </tr> <tr> <td style="text-align:center;">Thousand</td> <td style="text-align:center;">K</td> <td style="text-align:center;">588,000</td> <td style="text-align:center;"><?php echo thousandsCurrencyFormat(588000)?></td> </tr> </tbody> </table> </body> </html>
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.