Created
March 28, 2017 08:21
-
-
Save MrJSdev/05604f2439090bb80d0a0138d662397b to your computer and use it in GitHub Desktop.
dispaly numbers into words example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php echo convert_number_to_words(123456789); | |
| // one hundred and twenty-three million, four hundred and fifty-six thousand, seven hundred and eighty-nine | |
| echo convert_number_to_words(123456789.123); | |
| // one hundred and twenty-three million, four hundred and fifty-six thousand, seven hundred and eighty-nine point one two three | |
| echo convert_number_to_words(-1922685.477); | |
| // negative one million, nine hundred and twenty-two thousand, six hundred and eighty-five point four seven seven | |
| // float rounding can be avoided by passing the number as a string | |
| echo convert_number_to_words(123456789123.12345); // rounds the fractional part | |
| // one hundred and twenty-three billion, four hundred and fifty-six million, seven hundred and eighty-nine thousand, one hundred and twenty-three point one two | |
| echo convert_number_to_words('123456789123.12345'); // does not round | |
| // one hundred and twenty-three billion, four hundred and fifty-six million, seven hundred and eighty-nine thousand, one hundred and twenty-three point one two three four five |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment