I\'m trying to use the eval function for php. but I\'m stuck in handling the parse error. like considering if I have edge cases like 1.. or 1++ if gives me parse error:synta
From the manual
As of PHP 7, if there is a parse error in the evaluated code,
eval()
throws aParseError
exception. Before PHP 7, in this caseeval()
returnedFALSE
and execution of the following code continued normally. It is not possible to catch a parse error ineval()
usingset_error_handler()
.
Instead use this:
getMessage()."\n";
}
https://3v4l.org/1giOS