eval();
| From: | John Taylor-Johnston | Date: | Mon, 31 Oct 2005 02:16:58 +0000 |
| Subject: | eval(); | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-224854@lists.php.net to get a copy of this message | ||
I need to generate embedded php within in a mysql record. $contents is the actual contents of that record.
<?php
$contents = "<div class=\"indent\" style=\"font-size: 16px; font-family: arial,helvetica; font-weight: bold;\">About the Project</div>
<?php echo \"hello world\"; ?>";
echo eval($contents);
?>
I get this error:
Parse error: parse error in /var/www/html2/test.php(4) : eval()'d code on line 1
If I just echo $contents, my browser spits out:
<div class="indent" style="font-size: 16px; font-family: arial,helvetica; font-weight: bold;">About the Project</div>
<?php echo "hello world"; ?>
What's wrong? eval() is the correct thing to do, I thought?