PHP code example of splendour / number-to-text

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

    

splendour / number-to-text example snippets


use Splendour\NumberToText;

// create the number to text "transformer" class
$transformer = new NumberToText(1);

// set translation using the RFC 3066 language identifier
$transformer->setTranslation('tr'); //en is default

$transformer->toText(); // outputs "one"

$text = new NumberToText(11);
$text->toText(); //eleven

$text = new NumberToText(1253);
$text->setTranslation('tr');
$text->toText(); //bin ikiyüzelliüç

$text = new NumberToText(6420729122344886326918433610716);
$text->toText(); //six nonillion fourhundredtwenty octillion sevenhundredtwentynine septillion onehundredtwentytwo sextillion threehundredfortyfour quintillion eighthundredeightysix quadrillion twohundredseventytwo trillion onehundredsixtyeight billion sixhundredsixteen million fourhundredtwentyfour thousand onehundredsixtyeight