PHP code example of degecko / super-number

1. Go to this page and download the library: Download degecko/super-number 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/ */

    

degecko / super-number example snippets


function number ($n) {
    return new DeGecko\SuperNumber($n);
}

number(3.1)->mutate(function ($value) {
    return (int) $value;
}); // Returns 3

number(10)->printf('%d'); // Returns 10
number(10)->printf('$%.2f'); // Returns $10.00

number(1000)->format(); // Returns 1,000
number(1000)->format(2); // Returns 1,000.00
number(1000)->format(2, '_'); // Returns 1,000_00
number(1000)->format(2, '_', '-'); // Returns 1-000_00