<?php
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
class Foo
{
public function __construct($value)
{
$this->value = (string) $value;
}
public function getValue()
{
return $this->value;
}
}
$exprLang = new ExpressionLanguage();
$foo = new Foo('Bar');
$expr = 'foo.getValue() ~ " is the value."';
echo $exprLang->evaluate($expr, array(
'foo' => $foo,
));