I am working on small template class. I need help in converting {$variable} written in template file to be converted to
Like :
<html>
<body>
<p> Hey Welcome {$username} </p>
</body>
</html>
to be converted to
<html>
<body>
<p> Hey Welcome <?php echo $username ?> </p>
</body>
</html>
Just like variable username. there can be any variable with any length. I just want to convert it to php echo statment.
I think it is possible with preg_replace() but don't know how.
preg_replace()
and notstr_replace()
? Why replace it with PHP code instead of the real value? – str Jun 14 '13 at 12:57