PHP code example of phpcommon / intmath

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

    

phpcommon / intmath example snippets


// Output on 64-bit system: float(9.2233720368548E+18)
var_dump(PHP_MAX_INT + 1);

// Output on 64-bit system: int(-9223372036854775808)
var_dump(IntMath::add(PHP_MAX_INT, 1));

 // Outputs int(-100)
 var_dump(IntMath::negate(100));
 

 // Outputs int(300)
 var_dump(IntMath::add(100, 200));
 

 // Outputs int(90)
 IntMath::subtract(100, 10);
 

 // Outputs int(200)
 IntMath::multiply(100, 2);
 

 // Outputs int(50)
 IntMath::divide(100, 2);