layered / safe-eval
Safely evaluate code expressions
v0.2
2019-05-02 09:46 UTC
Requires (Dev)
- phpunit/phpunit: ^7.5
This package is auto-updated.
Last update: 2025-03-29 00:44:58 UTC
README
Safely evaluate code expressions in PHP, without using eval
. ExpressionLanguage is most likely better at this, but SafeEval still supports PHP 5, for the projects that need it.
Usage
use Layered\SafeEval\SafeEval; $safeEval = new SafeEval; echo $safeEval->eval('1 + 2'); var_dump($safeEval->eval('1 or 0'));