-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the numberToWordsMultiLanguage for PHP wiki!
You can convert any number (currently not larger than 999 billion! it's just a matter of adding several more line of languages to support more. You can see the example.php to see how it works; nevertheless, here are some more explanations:
All you need to do is just adding loader.php file, if nothing has been changed regarding the file or if no permission error has occurred, it loads the libraries.
Now, you create an instance of NumberToWordsUtility
under the namespace MT\Libraries:
$numberToWords = new \MT\Libraries\NumberToWordsUtility();
$result = $numberToWords->runProcessor(15847855);
print $result;
//expected output: fifteen million and eight hundred and forty seven thousand and eight hundred and fifty five
You can change the language on the fly by doing this:
$result = $numberToWords->setCurrentLanguage("fa")->runProcessor($number);
Files: loader.php => The only file that you should include in your project. languages.php => a file containing the literal equivalences for numbers and conjunctions NumberToWordsUtility.php => The main class. YOU SHOULD USE THIS CLASS ONLY NumberToWordsLanguage.php => A class responsible for handling linguistic operations, this class is used internally, you do not need to access it directly. configurations.php => [Currently Unused]
Version 0.0.1
Languages Supported: English(en), Persian(fa)
Features of Version 0.0.1:
-Ability to change language equivalences through languages.php file -Changing the language on the fly -Control over conjunctions per language and per digits length (1,2,3)
For example you can set the conjunction for thousands to be " and and " or to be " " in languages file, conjunctive phrases section.