Skip to content

How to use PHP NumberFormatter to convert numbers to words

Enable intl extension in PHP.ini (Remove the semicolon before)
extension=intl

Run composer update

to use the PHP NumberFormatter import class NumberFormatter
use NumberFormatter;

create an instance of the class like below:
$numberFormatter = new NumberFormatter(‘en’,NumberFormatter::SPELLOUT);
then use this instance to convert the desired numbers to words
$numberFormatter->format(yourValue);

Leave a Reply

Your email address will not be published. Required fields are marked *