PHP code example of djunehor / word-to-number

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

    

djunehor / word-to-number example snippets


use Djunehor\Number\WordToNumber;

$wordToNumber = new WordToNumber();
$wordTransformer = $wordToNumber->getWordTransformer();
// you can specify locale via: $wordToNumber->getWordTransformer('en');
$number = $wordTransformer->toNumber($word);

$number = word_to_number($word);
// default locale is en

$number = word_to_number($word, 'yo');
// specify Yoruba locale