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 str_replace(), but I swear there has to be an easier way!
Example:
<?php
// Returns '1.2.3';
echo str_replace('%', array(1, 2, 3), '%.%.%');
?>
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?
As recommended by Scuzzy in the comments,
vsprintf()turned out to be exactly what I was looking for. Thanks!