1. Go to this page and download the library: Download rezzza/formulate 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/ */
rezzza / formulate example snippets
use Rezzza\Formulate\Formula;
$formula = new Formula('{{ variable1 }} + {{ variable2 }}');
$formula->setParameter('variable1', 10);
$formula->setParameter('variable2', 13);
echo $formula->render(); // "10 + 13"
$formula->setIsCalculable(true);
echo $formula->render(); // "23"
// Works with sub formulas
$formula = new Formula('{{ subformula1 }} + {{ variable2 }}');
$formula->setSubFormula('subformula1', new Formula('({{ variable1 }} - {{ variable2 }} / 100)'));
$formula->setParameter('variable1', 10);
$formula->setParameter('variable2', 13);
echo $formula->render(); // (10 - 13 / 100) + 13