note 12129 deleted from function.eval by jimw

From: Date: Sat, 08 Dec 2001 23:24:58 +0000
Subject: note 12129 deleted from function.eval by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-22321@lists.php.net to get a copy of this message
If you want some code to be evaluated inside its own scope, wrap the eval() function inside a new function. E.g.: function eval_wrap($str) { return eval($str); } /* Demonstration */ $x = 'not changed'; $str = "\$x = 'changed';"; eval_wrap($str); print $x; The evaluated code will not modify $x, because it is run inside a separate scope.

« previous php.notes (#22321) next »