Pretty simple question, I believe. How to print the entire page in a variable and then use it where I need it.
For example, if the code:
<?php
$arr = array('hello','mate','world');
foreach ($arr as $a) {print "<p>".$a."</p>"; }
?>
Now, if we go to this page, we will see the output of the array, but I would prefer to print the entire page in a variable and then generate a static page from it.
Perhaps, file_get_content or <<<EOTbut the page will be more complex later, so I'm not sure what is the best option.
source
share