Re: Processing Code created on the fly

From: Date: Mon, 01 Apr 2002 14:18:25 +0000
Subject: Re: Processing Code created on the fly
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-90949@lists.php.net to get a copy of this message
On Friday, March 29, 2002, at 11:39 PM, Jonathan Duncan wrote:
I have read the page for eval on php.net several times as well as the very helpful examples, but whenever I use eval, it just prints out the same stuff. By same stuff I mean wether I use eval or just the variable by itself it just prints out the contents of the variable. In the web page source it looks as if the contents were merely echoed because it still has the $'s and variable names. Any other ideas or examples on how to implement eval on this?
eval() can let your variable contain PHP code in addition to simple text or HTML. That's what makes it different from just "echoing back the text". So you could do $print_statement = "print('test');"; eval($print_statement); // the output is "test", not "print('test');" I just learned this function myself. HTH, Erik ---- Erik Price Web Developer Temp Media Lab, H.H. Brown pricee@hhbrown.com

« previous php.general (#90949) next »