title: How to return only named groups with preg_match or preg_match_all?
body: <p>Example:</p>
  
  <pre><code>$string = "This is some text written on 2010-07-18.";
  preg_match('|(?&lt;date&gt;\d\d\d\d-\d\d-\d\d)|i', $string, $arr_result);
  print_r($arr_result);
  </code></pre>
  
  <p>Returns:</p>
  
  <pre><code>Array
  (
      [0] =&gt; 2010-07-18
      [date] =&gt; 2010-07-18
      [1] =&gt; 2010-07-18
  )
  </code></pre>
  
  <p>But I want it to be:</p>
  
  <pre><code>Array
  (
      [date] =&gt; 2010-07-18
  )
  </code></pre>
  
  <p>In PHP's PDO object there is an option that is filtering results from database by removing these duplicate numbered values : <a href="http://www.php.net/manual/en/pdostatement.fetch.php" rel="noreferrer"><code>PDO::FETCH_ASSOC</code></a>. But I haven't seen similar modifier for the PCRE functions in PHP yet.</p>