note 71236 added to function.eval
| From: | npugh at tacc dot utah dot edu | Date: | Sat, 18 Nov 2006 02:08:55 +0000 |
| Subject: | note 71236 added to function.eval | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-119847@lists.php.net to get a copy of this message | ||
"Also remember that variables given values under eval() will retain these values in the main
script afterwards."
This line confused me for a moment. What they mean is that if you modify a variable that was
declared outside of the eval code from within the eval, it stays modified. Of course.
What it does _not_ do is make any newly created variables global, which is what I was worried about.
Variables created from inside an eval will retain the same scope as where the eval statement was
called from (or lesser scope if they were created inside a function inside the eval, etc).
"If eval() is the answer, you're almost certainly asking the
wrong question." -- Rasmus Lerdorf, BDFL of PHP
It seems to me that eval is the only fix for the static class members + inheritance problem(as of
PHP5).
----
Server IP: 64.71.164.2
Probable Submitter: 67.41.171.17
----
Manual Page -- http://www.php.net/manual/en/function.eval.php
Edit -- https://master.php.net/note/edit/71236
Del: integrated -- https://master.php.net/note/delete/71236/integrated
Del: useless -- https://master.php.net/note/delete/71236/useless
Del: bad code -- https://master.php.net/note/delete/71236/bad+code
Del: spam -- https://master.php.net/note/delete/71236/spam
Del: non-english -- https://master.php.net/note/delete/71236/non-english
Del: in docs -- https://master.php.net/note/delete/71236/in+docs
Del: other reasons-- https://master.php.net/note/delete/71236
Reject -- https://master.php.net/note/reject/71236
Search -- https://master.php.net/manage/user-notes.php