1. Go to this page and download the library: Download williams/xpression 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/ */
williams / xpression example snippets
use Williams\Xpression\Xpression;
$xp = Xpression::new();
echo $xp->evaluate('2*3+4'); // 10
$comparisons = [
"2=2", // 1 - Equal to
"4<3", // 0 - Less Than
"5>2", // 1 - Greater Than
"7<=7", // 1 - Less Than or Equal To
"8>=9", // 0 - Greater Than or Equal to
"2<>6", // 1 - Not Equal To
];
// Example using variables:
$xp->with([
'a' => 7,
'b' => 5
]);
echo $xp->evaluate('$a-$b'); // 2