title: preg_replace() help to convert {$variable} to php echo variable statement
body: <p>I am working on small template class. I need help in converting {$variable} written in template file to be converted to  </p>
  
  <p>Like : </p>
  
  <pre><code>&lt;html&gt;
     &lt;body&gt;
        &lt;p&gt; Hey Welcome {$username} &lt;/p&gt; 
     &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>to  be converted to </p>
  
  <pre><code>    &lt;html&gt;
     &lt;body&gt;
        &lt;p&gt; Hey Welcome &lt;?php echo $username ?&gt; &lt;/p&gt; 
     &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Just like variable username. there can be any variable with any length. I just want to convert it to php echo statment.</p>
  
  <p>I think it is possible with preg_replace() but don't know how.</p>