I know eval
should be avoided in JavaScript for speed and security reasons. But in the case of PHP, rarely is security ever mentioned. More often, it\'s your pr
i know eval should be avoided in javascript for speed and security reasons. but in the case of php, rarely is security ever mentioned. more often it's your program running slower than it should because of haphazard use of eval.
eval
is evil in php too.
in what specific situations should you use eval() because there is no other way around it?
First of all, we try to avoid it as much as possible, but if you do have to use that for executing some code, then you will have to go with that but as said it is evil, you use at your own risk.
Bottom Line:
Never allow at any rate, the user input to be run with eval
. (Unless You Know What You Are Doing/Risking)