eclipsio / number-humanoid
Convert Number to Identifier in K(thousands), M(Millions), B(Billions), T(Trillions).
v2.0.0
2023-07-25 05:41 UTC
Requires
- php: ^7.2 || ^8.0
README
A Class for converting a number to a human readable string with K,M,B,T etc.
Install
composer require eclipsio/number-humanoid
Example Human Readable String
<?php
use Eclipsio\NumberHumanoid\Humanoid;
$num = 10200;
$human = new Humanoid($num);
echo $human->out; // 10.20K
echo $human->number; // 10.20
echo $human->expression; // K
Number to Words
This Class allows to conver a number to words, which supports about quadrillion as well as decimals too.
How to use
use Eclipsio\NumberHumanoid\NumberToWords; $num = 71176482.556; $str = NumberToWords::toWords($num); echo $str;
Output will be
seventy one millions one hundred seventy six thousands four hundred eighty two point five five six