note 114731 added to function.eval

From: Date: Sun, 30 Mar 2014 22:48:59 +0000
Subject: note 114731 added to function.eval
Groups: php.notes 
Request: Send a blank email to php-notes+get-199075@lists.php.net to get a copy of this message
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. ---- Server IP: 87.106.1.137 Probable Submitter: 79.215.155.45 ---- Manual Page -- http://php.net/manual/en/function.eval.php Edit -- https://master.php.net/note/edit/114731 Del: integrated -- https://master.php.net/note/delete/114731/integrated Del: useless -- https://master.php.net/note/delete/114731/useless Del: bad code -- https://master.php.net/note/delete/114731/bad+code Del: spam -- https://master.php.net/note/delete/114731/spam Del: non-english -- https://master.php.net/note/delete/114731/non-english Del: in docs -- https://master.php.net/note/delete/114731/in+docs Del: other reasons-- https://master.php.net/note/delete/114731 Reject -- https://master.php.net/note/reject/114731 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#199075) next »