PHP code example of pronamic / wp-number

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

    

pronamic / wp-number example snippets



$a = 1234; // decimal number
$a = 0123; // octal number (equivalent to 83 decimal)
$a = 0x1A; // hexadecimal number (equivalent to 26 decimal)
$a = 0b11111111; // binary number (equivalent to 255 decimal)
$a = 1_234_567; // decimal number (as of PHP 7.4.0)

$number = Number::from_float( 123.50 )->add( 0.45 );

echo \esc_html( $number->format_i18n( 2 ) );