title: php array regular expressions
body: <p>I am using regular expressions in php to match postcodes found in a string. </p>
  
  <p>The results are being returned as an array, I was wondering if there is any way to assign variables to each of the results, something like </p>
  
  <pre><code>$postcode1 = first match found
  $postcode2 = second match found
  </code></pre>
  
  <p>here is my code</p>
  
  <pre><code>$html = "some text here bt123ab and another postcode bt112cd";
  preg_match_all("/([a-zA-Z]{2})([0-9]{2,3})([a-zA-Z]{2})/", $html, $matches, PREG_SET_ORDER);
  
  foreach ($matches as $val) {
      echo $val[0]; }
  </code></pre>
  
  <p>I am very new to regular expressions and php, forgive me if this is a stupid question.</p>
  
  <p>Thanks in advance</p>