evopix/pheddar

This package is abandoned and no longer maintained. No replacement package was suggested.

PHP library to convert human readable strings to numbers

dev-master 2012-03-05 07:26 UTC

This package is not auto-updated.

Last update: 2020-01-24 14:46:39 UTC


README

Pheddar is a port of the Ruby library Cheddar.

Examples

The basics.

<?php

use Pheddar\Human;

Human::to_number('15 hundred');
// => 1500

Human::to_number('$200 million');
// => 200000000

Human::to_number('15.72 vigintillion');
// => 1.5720000000000002E+64

Slightly more advanced.

<?php

Human::to_number('25 bucks');
// => 25

Human::to_number('20 large');
// => 2000

Human::to_number('33 straight up large bills');
// => 3300