PHP Code Execution Lib
Executes Code
This library executes PHP code dynamically with fine-grained control.
Some features:
- Execute PHP code via `eval`.
- Execute PHP code via temporary include files.
- Capture output, return values, and modified variables.
- Inject external variables into executed code.
- Ignore undefined variable errors when needed.
- Safely handle execution failures.
Usage:
Execute PHP Code based in eval:
Executes HTML with PHP code.
Execute PHP Code with error control:
Executes HTML with PHP code but ignore errors if a PHP variable is not defined.
Execute PHP Code based in include file:
The difference between this method and the parseContent method, is that, if there is an error in some php statement of the $contents, this method returns an empty result, because the error will be catched with no return string. Instead of the parseContent method, that executes each php statement separately returning the rest of the result and only giving error in the catched php statement with error.