PHP code example of mormat / php-formula-interpreter

1. Go to this page and download the library: Download mormat/php-formula-interpreter 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/ */

    

mormat / php-formula-interpreter example snippets


$compiler = new \Mormat\FormulaInterpreter\Compiler();

$executable = $compiler->compile('2 + 2');

$result = $executable->run();
// $result equals 4

$variables = array(
   'price' => 40.2,
   'rate' => 12.8
);

$executable->run($variables);
bash
composer