note 71236 deleted from function.eval by danbrown

From: Date: Sun, 17 May 2009 19:55:00 +0000
Subject: note 71236 deleted from function.eval by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-155291@lists.php.net to get a copy of this message
Note Submitter: npugh at tacc dot utah dot edu ---- "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).

« previous php.notes (#155291) next »