Number-to-Word Conversion with PHP

Often it is required to convert a number or integer to English Words for printing on invoices or for displaying final bill on checkout pages of online shopping carts.

This function accepts integer or string representation of integer and converts to English words. This can be helpful for your online shopping carts, and for generating invoices online.

Dependencies

number_to_word() requires two additional functions trim_all() and str_replace_last().

Sources

Names of Large Numbers collected from wikipedia.

Usage