1. Go to this page and download the library: Download biin2013/calculator 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/ */
biin2013 / calculator example snippets
$calculator = new Calculator('(3+4*5-8)7-100/(20+30)');
// or
$calculator = Calculator::make('(3+4*5-8)7-100/(20+30)');
// or
$calculator = Calculator::make()->setFormula('(3+4*5-8)7-100/(20+30)');
// use replaces;
$calculator = Calculator::make()
->setFormula('(y+4*5-8)7^y-ab/(20+30)')
->setReplaces(['ab' => 100, 'y' => 3]);
$calculator->calculate();
// or use parameter
Calculator::make()->calculate(
'(y+4*5-8)7^y-ab/(20+30)',
['ab' => 100, 'y' => 3]
);