PHP code example of manychois / peval
1. Go to this page and download the library: Download manychois/peval 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/ */
manychois / peval example snippets
use Manychois\Peval\Parser;
use Manychois\Peval\Evaluator;
// Create parser and evaluator
$parser = new Parser();
$evaluator = new Evaluator();
$expression = $parser->parse('"Hello {$name}!"');
$context = [
'name' => 'World',
];
echo $evaluator->evaluate($expression, $context); // print "Hello World!"