The eval() function evaluates a string as PHP code.The string must be valid PHP code and must end with semicolon.
mixed eval ( string $code )
Evaluates the given code as PHP.
Parameter | Description |
---|---|
code | Valid PHP code to be evaluated. |
eval() returns NULL unless return is called in the evaluated code, in which case the value passed to return is returned. As of PHP 7, if there is a parse error in the evaluated code, eval() throws a ParseError exception. Before PHP 7, in this case eval() returned FALSE and execution of the following code continued normally. It is not possible to catch a parse error in eval() using set_error_handler().