note 2358 deleted from function.eval by jimw
| From: | jimw@php.net | Date: | Sat, 08 Dec 2001 23:13:12 +0000 |
| Subject: | note 2358 deleted from function.eval by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-22310@lists.php.net to get a copy of this message | ||
Regarding eval()'ing a string that contains PHP and HTML code, this can be done easily using
the following technique:
<?
$value = 5;
$string = '<?php echo "Hello, world. value = $value"; ?>';
eval( "?>$string" );
?>
Regarding the note mentioned before, the trailing '<?' is not necessary and
actually will write '<?' in the evaluated HTML code.
The above code will produce:
Hello, world. value = 5
Have fun!
Noor Dawod, CTO
http://www.comrax.com/