title: PHP Using str_replace along with preg_replace
body: <p>I have a string of comma separated values that comes from a database, which actually are image paths. Like so:</p>
  
  <p><code>/images/us/US01021422717777-m.jpg,/images/us/US01021422717780-m.jpg,/images/us/US01021422717782-m.jpg,/images/us/US01021422718486-m.jpg</code></p>
  
  <p>I then do like below, to split them at the <code>,</code> and convert them into paths for the web page.</p>
  
  <p><code>preg_replace('~\s?([^\s,]+)\s?(?:,|$)~','&lt;img class="gallery" src="$1"&gt;', $a)</code></p>
  
  <p>Works well, but in one place further in my page, I need to change the <code>-m</code> to <code>-l</code> (which means large)</p>
  
  <p>When I do like below (put a str_replace inside the preg_replace), nothing happens. How can I do something like this?</p>
  
  <p><code>preg_replace('~\s?([^\s,]+)\s?(?:,|$)~','&lt;img class="gallery" src="$1" data-slide="'.str_replace('-m','-l','$1').'"&gt;', $a)</code></p>