Fastest way to replace string patterns by mask
<p>I have string like </p>

<pre><code>$string = "string_key::%foo%:%bar%";
</code></pre>

<p>, and array of params</p>

<pre><code>$params = array("foo" =&gt; 1, "bar" =&gt; 2);
</code></pre>

<p>How can I replace this params in $string pattern? 
Expected result is </p>

<pre><code>string_key::1:2
</code></pre>
