title: performing multiple preg_replace with different search & replace each time
body: <p>I've done something similar with str_replace using this:</p>
  
  <pre><code>$string = $url;
  $patterns = array();
      $patterns[0] = 'searchforme';
      $patterns[1] = 'searchforme1';
      $patterns[2] = 'searchforme2';
  $replacements = array();
      $replacements[0] = 'replacewithme';
      $replacements[1] = 'replacewithme1';
      $replacements[2] = 'replacewithme2';
  $searchReplace = str_replace($patterns, $replacements, $string);
  </code></pre>
  
  <p>How would I go about doing something similar with preg_replace?</p>
  
  <p>I've built a very simple little css parser that searches for a specific tag within a comment wrapped around CSS properties, and replaces it with new data.</p>
  
  <pre><code>$stylesheet = file_get_contents('temp/'.$user.'/css/mobile.css');
  
  $cssTag = 'bodybg';
  $stylesheet = preg_replace("/(\/\*".$cssTag."\*\/).*?(\/\*\/".$cssTag."\*\/)/i", "\\1 background: $bg url(../images/bg.png) repeat-x; \\2", $stylesheet);
  
  file_put_contents('temp/'.$user.'/css/mobile.css',''.$stylesheet.'');
  </code></pre>
  
  <p><strong>I have multiple "cssTag"'s and they'll all need unique css to replace with (background, color, font-size etc) which is why I'm looking for a method like the str_replace one above.</strong></p>