Skip to content
Advertisement

Amount in Words prints values as ones after the decimal point – PHP

I have a PHP function to print amounts in words, It works fine till the decimal, but the later decimal point, it prints the value as of in one’s place.

Like, if the value is “54.35”, it prints “Fifty-Four Three Five” Instead, it should print like “Fifty Four Thirty-Five”.

The code goes as :

JavaScript

Any help is appreciated.

Advertisement

Answer

You can get your expected output by this.

JavaScript

Output :

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement