So say I have a file page.php
<html>
Hello <?php echo $world;?>
</html>
I want to create a variable and assign it ‘Hello world’ using page.html
Something like
$world = 'world';
$mypage = parse_file('page.php');
I suppose I could wrap the entire file in doublequotes as such
$mypage="<html>
Hello $world
</html>";
but doublequote parsing is inefficient. Is there any easy of doing this without having to write a script that parses page.html?
Output buffering will do this nicely
Reference:
ob_start()ob_get_clean()