title: Using preg_replace on an array
body: <p>I have a relatively large array of elements which I want to search for a string and replace any matches. I'm currently trying to do this using <code>preg_replace</code> and regular expressions:</p>
  
  <pre><code>preg_replace("/\d?\dIPT\.\w/", "IPT", $array);
  </code></pre>
  
  <p>I want to get all values which match either <code>00IPT.A</code> or <code>0IPT.A</code> (with <code>0</code> representing any numerical character and <code>A</code> representing any letter) and replace them with <code>IPT</code>. However, I'm getting array to string conversion notices. Is there any way to get <code>preg_replace</code> to accept an array data source? If not, is there any other way I could achieve this?</p>
  
  <p>The documentation says that <code>preg_replace</code> should be able to accept array sources — this is the reason I'm asking.</p>
  
  <blockquote>
    <p>The string or an array with strings to search and replace.
    If subject is an array, then the search and replace is performed on every entry of       subject, and the return value is an array as well.</p>
  </blockquote>
  
  <p><strong>The array is multidimensional if that helps (has multiple arrays under one main array).</strong></p>