PHP code example of jurchiks / numbers2words

1. Go to this page and download the library: Download jurchiks/numbers2words library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jurchiks / numbers2words example snippets


use js\tools\numbers2words\Speller;

Speller::spellNumber(123, Speller::LANGUAGE_RUSSIAN);
// output: сто двадцать три
Speller::spellCurrency(123, Speller::LANGUAGE_ENGLISH, Speller::CURRENCY_EURO, false);
// output: one hundred twenty three euro
Speller::spellCurrency(123, Speller::LANGUAGE_ENGLISH, Speller::CURRENCY_EURO);
// output: one hundred twenty three euro and 0 cents
Speller::spellCurrency(123.45, Speller::LANGUAGE_ENGLISH, Speller::CURRENCY_EURO, true, true);
// output: one hundred twenty three euro and forty five cents
Speller::spellCurrencyShort(123.45, Speller::LANGUAGE_ENGLISH, Speller::CURRENCY_EURO);
// output: one hundred twenty three EUR 45/100