PHP code example of laravel-ready / readable-numbers

1. Go to this page and download the library: Download laravel-ready/readable-numbers library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

laravel-ready / readable-numbers example snippets



use LaravelReady\ReadableNumbers\Services\ReadableNumbers;

...

$readableNumber = ReadableNumbers::make(123456789); // 123.5 M
$readableNumber = ReadableNumbers::make(-123456789); // -123.5 M

// with more decimals
$readableNumber = ReadableNumbers::make(123456789, 2); // 123.46 M

// with target language (default is english)
$readableNumber = ReadableNumbers::make(123456789, 2, 'tr'); // 123.46 Mn
$readableNumber = ReadableNumbers::make(123456789, 3, 'ja'); // 123.457 億
$readableNumber = ReadableNumbers::make(123456789, 4, 'de'); // 123.4568 Mio.