How to use objects, variables in an eval() func ?
| From: | LPA | Date: | Tue, 10 Jun 2003 07:22:48 +0000 |
| Subject: | How to use objects, variables in an eval() func ? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-150856@lists.php.net to get a copy of this message | ||
Hi,
I have an eval which evaluate a block of code before echo the result on the screen.. Here is the
func :
function t_eval($texte) {
ob_start();
eval("?>".$texte);
$retval = ob_get_contents();
ob_end_clean();
return $retval;
}
But I use some objects for databases, ... and when i trying to execute this code i have this text.
Fatal error: Call to a member function on a non-object in k:\program
files\easyphp\www\dhea\include\php\functions_conversion.inc.php(23) : eval()'d code on line 9
What to do ?
Thanx
Laurent