I'll be storing web pages in a database, and in some cases I will want to execute PHP code in them. In those cases I will eval() the page, but knowing that eval() tends to decrease performance, I want to make it as slick as possible.
Just how bad is it to use eval() on a lot of code?
If the evaluated code is mostly escaped HTML, like eval("?>$htmlWithOccasionalPhp<?php"), will it be slowed down less than if it was all within "<?php ?>"?
If the evaluated code only requires an external script, will that script's code be evaluated, or will it run faster since only the require() statement needs to be evaluated? Example:
// This is the string I fetch from the DB.
$htmlWithOccasionalPhp =
"<p>Blah blah blah</p>
<?php require('bigscript.php'); ?>
<p>Blah blah blah</p>";
eval("?>$htmlWithOccasionalPhp<?php");