title: Storing dig output in array
body: <p>I have this MX output in <code>$ip</code>:</p>
  
  <pre><code>10 ASPMX2.GOOGLEMAIL.COM. 10 ASPMX3.GOOGLEMAIL.COM. 1 ASPMX.L.GOOGLE.COM. 5 ALT1.ASPMX.L.GOOGLE.COM. 5 ALT2.ASPMX.L.GOOGLE.COM.
  </code></pre>
  
  <p>The number is the priority and the subdomain is the mail server. How could I stored them in array like this:</p>
  
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [0] =&gt; 10
              [1] =&gt; ASPMX2.GOOGLEMAIL.COM.
          )
      [1] =&gt; Array
          (
              [0] =&gt; 10
              [1] =&gt; ASPMX3.GOOGLEMAIL.COM.
          )
  ...
  )
  </code></pre>
  
  <p>The hard part is the whole output could be anything. I mean the mail server subdomain name and the number of server could be random. In the above is 5 mail server but it could be 3 or just 1 server (not to be confuse with mail server priority number).</p>
  
  <p>I'm thinking about <code>preg_match</code>, but the random subdomain name just leaves me clueless.  Any idea?</p>