PHP code example of lang / equation
1. Go to this page and download the library: Download lang/equation 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/ */
lang / equation example snippets
use Lang\Equation\Equation;
$expr = Equation::parse('1+1');
echo $expr->getValue();
// Output: 2
// With params
// !notice parameter name format: ':param_name:'
$expr2 = Equation::parse('2 + :var:');
echo $expr2->getValue(['var' => 2]);
// Output: 4