PHP code example of blackjew / number-to-words

1. Go to this page and download the library: Download blackjew/number-to-words 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/ */

    

blackjew / number-to-words example snippets


use BlackJew\NumberToWords\NumberToWords;

// create the number to words "manager" class
$numberToWords = new NumberToWords();

// build a new number transformer using the RFC 3066 language identifier
$numberTransformer = $numberToWords->getNumberTransformer('en');

$numberTransformer->toWords(5120); // outputs "five thousand one hundred twenty"

use BlackJew\NumberToWords\NumberToWords;

// create the number to words "manager" class
$numberToWords = new NumberToWords();

// build a new currency transformer using the RFC 3066 language identifier
$currencyTransformer = $numberToWords->getCurrencyTransformer('en');

$currencyTransformer->toWords(25000, 'UGX'); // outputs "twenty-five thousand ugandan shillings"