PHP template string replace
<p>just wondering what's the best approach for template String replace.</p>

<pre><code>preg_replace('/{%(\S+)%}/', 'bill', $tableOutput);
</code></pre>

<p>With the preg_replace, if there are lots of string needs to be replace, the function will be called many times depend on the number of string needs to be replace. Just wondering if there is a way can look though string once and replace accordingly?</p>

<p>Thanks</p>
