PHP code example of bradietilley / bcmath-number

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

    

bradietilley / bcmath-number example snippets


use BCMath\Number; // or use BradieTilley\BCMath\Number;

$number = new Number('34.465');
$result = $number->add('76.2');

echo (string) $result; // 110.665

// Number class is immutable so the original $number value remains. Resulting value are returned in a new object.
echo (string) $number; // 34.465