PHP code example of intelogie / numeral.php

1. Go to this page and download the library: Download intelogie/numeral.php 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/ */

    

intelogie / numeral.php example snippets


// +10,000
$formatter->format(1000.23, '+0,0');

// 233.43k
$formatter->format(233434, '0a.00');



use Stillat\Numeral\Languages\LanguageManager;
use Stillat\Numeral\Numeral;

// Create the language manager instance.
$languageManager = new LanguageManager;

// Create the Numeral instance.
$formatter = new Numeral;

// Now we need to tell our formatter about the language manager.
$formatter->setLanguageManager($languageManager);

// 1,000
$string = $formatter->format(1000, '0,0');

// $1000
$formatter->formatCurrency(1000.234);

// $1000.23
$formatter->formatCurrency(1000.234, '0[.]00');

// -10000
$number = $formatter->unformat('($10,000.00)');

$formatter->setZeroFormat('N/A');

// 'N/A'
$number = $formatter->format('0');