1. Go to this page and download the library: Download collab-corp/ez-math 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/ */
collab-corp / ez-math example snippets
use CollabCorp\EzMath;
$math = (new Math(20))->add(2)->get(); //22.00
//or can cast object as string instead of calling get();
echo (string)(new Math(20))->add(2); // 22.00
# via method
$number = (new Math(3.5))->setPlaces(3);
# or via constructor's 2nd argument:
$number = new Math(3.5, 3);
# can do any operations where expected result wont exceed 3 decimal places.
$math->toDecimalPercent()->get(); // returns 0.035 instead of 0.03 had we kept the default 2 places.
use CollabCorp\EzMath;
$math = (new Math(20))
->add(2)
->subtract(2)
->divide(2)
->setPlaces(2)
->get(); //10.00
$math = (new Math(20))->setPlaces(4)->get(); //22.0000
//or you can always specify the places via the class constructor
$math = (new Math(20, 4))->get(); //20.0000
$math = (new Math(20,0))->add(2)->get(); //22
$math = $math->setValue(25)->get();//25.00
$math = (new Math(20,0))->add(2)->get(); //22
$math = $math->setPlaces(3)->get();//22.000
$math = (new Math(20))->add(2); //22.0000....
$math = (new Math(20))->subtract(2)->get(); //18.0000...
$math = (new Math(20))->divide(2)->get(); //10.00000000
$math = (new Math(20))->multiply(2)->get(); //40.00000000000
$math = (new Math(8))->modulus(5)->get(); //3.00000....
$math = (new Math(3.5))->setPlaces(3)->toDecimalPercent()->get(); // 0.035
// get 7% of 3950
$tax = (new Math(3950))->percentageOf(7)->setPlaces(2)->get(); //276.50
$math = (new Math(16))->squareRoot()->get(); // 4.00
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.