dev-master
9999999-dev https://github.com/drrcknlsn/number-converterA tool to convert numbers to their written lingual form.
MIT
The Requires
- php >=5.4.0
The Development Requires
by Derrick Nelson
converter number
Wallogit.com
2017 © Pedro Peláez
A tool to convert numbers to their written lingual form.
NumberConverter is a simple interface for converting numbers from their numeric representations into their written, lingual representations. Other, probably better solutions already exist (see below), and this was created only as a coding exercise., (*1)
$converter = new DrrckNlsn\NumberConverter\EnglishNumberConverter(); echo $converter->convert(1234567);
Output:, (*2)
one million two hundred thirty four thousand five hundred sixty seven
Currently, there is only an EnglishNumberConverter implementation, but the
project was created with other languages in mind., (*3)
This package comes with a simple CLI binary for demonstrating the
EnglishNumberConverter class, located at bin/convertNumber., (*4)
The recommended way to install NumberConverter is via Composer:, (*5)
composer require drrcknlsn/number-converter
After installing the dependency, you will need to require Composer's autoloader:, (*6)
require 'vendor/autoload.php';
The intl extension provides the NumberFormatter
class, which can be used to accomplish the same goal, using NumberFormatter::SPELLOUT., (*7)
A tool to convert numbers to their written lingual form.
MIT
converter number