I have this MX output in $ip
:
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.
The number is the priority and the subdomain is the mail server. How could I stored them in array like this:
Array
(
[0] => Array
(
[0] => 10
[1] => ASPMX2.GOOGLEMAIL.COM.
)
[1] => Array
(
[0] => 10
[1] => ASPMX3.GOOGLEMAIL.COM.
)
...
)
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).
I'm thinking about preg_match
, but the random subdomain name just leaves me clueless. Any idea?