PHP code example of itvisionsy / php-string-numbers
1. Go to this page and download the library: Download itvisionsy/php-string-numbers 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/ */
itvisionsy / php-string-numbers example snippets
use ItvisionSy\StringNumbers\StringNumbers;
echo StringNumbers::wordsToNumbers('one hundred fifty five');
//155
echo StringNumbers::wordsToNumbers('There are two hundred fifty five thousand two hundred twelve leaves on the tree');
//There are 255212 leaves on the tree
echo StringNumbers::wordsToNumbers('Ten men bought 2 hundred devices in less than a week for more than two million dollars');
//10 men bought 200 devices in less than a week for more than 2000000 dollars
echo StringNumbers::numbersToWords('155');
//one hundred fifty five
echo StringNumbers::numbersToWords('There are 366 days in a leap year and 2016 was a leap year');
//There are three hundred sixty six days in a leap year two thousand sixteen was a leap year