note 106481 added to function.eval
| From: | socram8888 at gmail dot com | Date: | Sat, 12 Nov 2011 20:18:07 +0000 |
| Subject: | note 106481 added to function.eval | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-184411@lists.php.net to get a copy of this message | ||
It may be a bit obvious, but if you don't want eval'd code to interfere with main code
variables, all you have to do is to call an eval from another function like this:
function localeval($code) {
return eval($code);
};
$a = "a";
echo '$a before eval code: ' . $a . "\n"; // prints "a"
localeval('$a = \'b\';');
echo '$a after localeval: ' . $a . "\n"; // still prints "a"
eval('$a = \'b\';');
echo '$a after eval: ' . $a . "\n"; // prints "b"
----
Server IP: 69.147.83.197
Probable Submitter: 84.123.88.202
----
Manual Page -- http://www.php.net/manual/en/function.eval.php
Edit -- https://master.php.net/note/edit/106481
Del: integrated -- https://master.php.net/note/delete/106481/integrated
Del: useless -- https://master.php.net/note/delete/106481/useless
Del: bad code -- https://master.php.net/note/delete/106481/bad+code
Del: spam -- https://master.php.net/note/delete/106481/spam
Del: non-english -- https://master.php.net/note/delete/106481/non-english
Del: in docs -- https://master.php.net/note/delete/106481/in+docs
Del: other reasons-- https://master.php.net/note/delete/106481
Reject -- https://master.php.net/note/reject/106481
Search -- https://master.php.net/manage/user-notes.php