Replacing one substring multiple times without looping? (using an array of replacements)
<p>Is it possible to replace one substring multiple times in a string, but with different replacements? I know this can be done with a loop and <code>str_replace()</code>, but I swear there has to be an easier way!</p>

<p>Example:</p>

<pre><code>&lt;?php
// Returns '1.2.3';
echo str_replace('%', array(1, 2, 3), '%.%.%');
?&gt;
</code></pre>

<p>Do I really need to start a loop on the string, and then replace one match at a time? That seems like a sloppy way to do something that should be much simpler. What am I missing?</p>
