PHP code example of phil / number-words

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

    

phil / number-words example snippets


use Phil\NumberWords\Gender;
use Phil\NumberWords\NumberWords;

$words = new NumberWords('fr_CA');
$words->cardinal(21);                      // vingt et un
$words->cardinal(21, Gender::Feminine);    // vingt et une
$words->ordinal(1, Gender::Feminine);      // première
$words->amount('120.05', 'CAD');           // cent vingt dollars et cinq cents
$words->amount('200000000', 'EUR');        // deux cents millions d'euros