Guide 20 - Transform Numbers to Words |
6/26/2021 10:55:28 AM |
PHPRunner Tips and Tricks | |
![]() As functions of converting numbers to words is a classic in programming. In this case, a PHPrunner developer requests me an example that allows you to turn numbers to words (English with dollars) and from that request I started looking at GitHub functions made in PHP that I would provide me with that functionality. I have found many codes, but with very different quality. It is true that I have sought those who are capable of transforming words into several languages (English, Spanish, etc.) because this way as an example that served more developers. In the end I have used:
DEMOS:
All the information and examples to be able to download them in my portal. |
|
![]() |
fhumanes author 6/26/2021 |
DEMOS:
This is the aspect of the example. In general it is a figure (2 decimals) and a language (the products come out) and the example, transforms that number to the words that describe the amount. In the case of classes of option 1 you can get an error, that's because that class has an option for coins and another that I have not put the example with currency and in that case not all languages are implemented, but It is easy to solve these problems (write me if you can not solve it). Coding is very simple. In the case of class (1): <?php In the case of class (2): require_once __DIR__ . '/../MyCode/num2text/Num2Text.php'; As always you indicated, for any questions or problems, please contact through my email fernandohumanes@gmail.com. I leave you, so you can install them in your PC, the 2 examples. You must select one for your project. As I indicated, I like (1), because in Spanish the transformation is much better. |