I have the following problem within the following script
PHP code:
$var = file_get_contents('template/default/index.php');
$content1 = str_replace('{php}','<?php',$var);
$content2 = str_replace('{/php}','?>',$content1);
echo $content2;
template/default/index.php code:
<!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
{php} echo 'worked'; {/php}
</body>
</html>
I'm trying to transform the {php}{/php} tags within the template/default/index.php to propper php tags. This actually happends, but the php code gets commented out. The browser gives this in return:
<h1>My First Heading</h1>
<p>My first paragraph.</p>
<!--?php echo 'worked'; ?-->
Does anybody know how to solve this?