note 114731 deleted from function.eval by googleguy

From: Date: Fri, 24 Feb 2017 21:07:27 +0000
Subject: note 114731 deleted from function.eval by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-208811@lists.php.net to get a copy of this message
Note Submitter: thomas at not dot my dot real dot domain dot com ---- eval() can easily be used in if-statements (in contrast to jkuckartz1984 at hotmail dot com): simply put a "return()" around the statement: if(eval('return($total'.$i.');')) ... And in answer to the top-comment: I use eval() for my personal bug-fixes in e.g. open-source-software, where a function gets old code and new code as strings, so it can produce a bugreport (with some more added information) and the new code is evaled by eval(). Just a little overhead, but a nice way to keep all my changes together. So I think, there are some "right" questions where eval() is the (proper) answer. At least I think, if you say "The eval() language construct is very dangerous because it allows execution of arbitrary PHP code." you just as well can say "PHP is very dangerous because it allows execution of arbitrary PHP code." The point is not to use any user provided data - that's all.

« previous php.notes (#208811) next »