PHP code example of systopia / expression-language-ext
1. Go to this page and download the library: Download systopia/expression-language-ext 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/ */
systopia / expression-language-ext example snippets
$expressionLanguage = new SystopiaExpressionLanguage();
$dateTime = $expressionLanguage->evaluate('date_create("2000-01-02 03:04:05")');
$array = [
'x' => (object) ['a' => 1, 'b' => 2],
'y' => (object) ['a' => 3, 'b' => 4],
];
$expressionLanguage = new SystopiaExpressionLanguage();
$mapped = $expressionLanguage->evaluate(
'map(array, "key ~ \": \" ~ (value.a + value.b)")',
['array' => $array]
);
var_dump($mapped);