Say I have a variable of a string that contains an html page. Within that html page variable I have an echo statement-
e.g. <?php echo 'whatever' ?>
Can I somehow "render" that variable to the browser, and have php evaluate all the php statements within the variable?
If I just echo the variable, the html renders fine but the php statements are not evaluated. If I try running eval on the entire page, it just throws an exception (makes sense).
I know this all sounds like bad practice, but I'm trying to figure out a way to do this without saving the variable to a file and loading the file.
BTW: I'm doing this all within codeigniter, so if there's a way to use $this->load->view on that variable... that would be even better :)
Example Code:
$x = /* Some logic to get a template data from another server */
/* $x is "<html><?php echo 'bla'; ?></html> */
echo $x;
This doesn't work- trying to run echo eval($x) also doesn't work