title: Multiple string replacements in the same string in php
body: <p>I have the following string replacement problem and I am in quite a fix here</p>
  
  <p>PFB the sample string</p>
  
  <pre><code>$string = 'The quick sample_text_1 56 quick sample_text_2 78 fox jumped over the lazy dog.';
  
  $patterns[0] = '/quick/';
  $patterns[1] = '/quick/';
  $patterns[2] = '/fox/';
  
  $replacements[2] = 'bear';
  $replacements[1] = 'black';
  $replacements[0] = 'slow';
  
  echo preg_replace($patterns, $replacements, $string);   
  </code></pre>
  
  <p>I need to replace 'quick' depending on the numbers i send</p>
  
  <p>i.e if my input to a function is <code>56</code>, the <code>quick</code> before <code>56</code> needs to be replaced with <code>bear</code> and if my input to a function is <code>78</code>, the quick before <code>78</code> needs to be replaced with <code>black</code></p>
  
  <p>Can someone please help me with this?</p>