2017 © Pedro Peláez
 

library php-string-numbers

A PHP class to convert from text to numbers and vice versa

image

itvisionsy/php-string-numbers

A PHP class to convert from text to numbers and vice versa

  • Wednesday, March 23, 2016
  • by mhh1422
  • Repository
  • 1 Watchers
  • 0 Stars
  • 87 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

php-string-numbers

A conversion class from text to numbers and vice versa, (*1)

Install

Using composer

composer require itvisionsy/php-string-numbers, (*2)

Direct download

It is only 1 class! Copy and paste it or download it directly! StringNumbers PHP Class, (*3)

How to use

There are two public static methods * ::numbersToWords($string) converts all digits numbers to written numbers. * ::wordsToNumbers($string) converts all written numbers to word numbers., (*4)

Note

some space characters may get added or removed by the conversion method. Use with care!, (*5)

Examples

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

License

PHP String Numbers project is under the MIT License, (*6)

The Versions

23/03 2016

dev-master

9999999-dev

A PHP class to convert from text to numbers and vice versa

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

23/03 2016

v1.0.1

1.0.1.0

A PHP class to convert from text to numbers and vice versa

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

23/03 2016

v1.0.0

1.0.0.0

A PHP class to convert from text to numbers and vice versa

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires