title: Getting all attributes from an <a> HTML tag with regex
body: <p>I already have a function that retrieves the <code>href</code> attribute from all of the <code>a</code> tags on a given page of markup. However, I would also like to retrieve other attributes, namely the <code>title</code> attribute.</p>
  
  <p>I have a feeling it's a simple modification of the regular expression that I'm already using, but my only concern is the order of appearance in the markup. If I have a link with this code:</p>
  
  <pre><code>&lt;a href="somepage.html" title="My Page"&gt;link text&lt;/a&gt;
  </code></pre>
  
  <p>I want it to be parsed the same and not cause any errors even if it appears like this:</p>
  
  <pre><code>&lt;a title="My Page" href="somepage.html"&gt;link text&lt;/a&gt;
  </code></pre>
  
  <p>Here is my processing function:</p>
  
  <pre><code>function getLinks($src) {
      if(preg_match_all('/&lt;a\s+href=["\']([^"\']+)["\']/i', $src, $links, PREG_PATTERN_ORDER))
          return array_unique($links[1]);
      return false;
  }
  </code></pre>
  
  <p>Would I have to use another regex all together, or would it be possible to modify this one so that the <code>title</code> attribute is stored in the same array of returned data as the <code>href</code> attribute?</p>