note 10151 deleted from function.eval by jimw

From: Date: Sat, 08 Dec 2001 23:23:31 +0000
Subject: note 10151 deleted from function.eval by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-22319@lists.php.net to get a copy of this message
I guess this is more of a hack than anything, but I really needed eval()'s code NOT to be displayed right away. So I used ob_start(), ob_get_contents(), and ob_end_clean(). <?php $stuff = "Hello, "; ob_start(); // start buffer eval("print 'World!';"); // execute code $retval = ob_get_contents(); // return executed code ob_end_clean(); // delete the buffer print $stuff.$retval; ?> This would print Hello, World! instead of World!Hello, .

« previous php.notes (#22319) next »