I have the following to read a file and assign to a string:
$insert_html = file_get_contents('view.php');
The view.php file itself looks like:
<div>This is price of your item: <?php echo $price; ?></div>
However, the PHP inside the file is not being executed. Both eval()
and include
don't quite give me what I want. What is the best way to do this?