<?php
if (getmxrr("qq.com", $mxhosts, $mxweights)) {
foreach ($mxhosts as $host) {
$hosts[] = dns_get_record($host, DNS_A);
}
}
function getall_by_key(array $arr, $key){
if (!trim($key)) return false;
preg_match_all("/\"$key\";\w{1}:(?:\d+:|)(.*?);/", serialize($arr), $output);
return $output[1];
}
print_r(getall_by_key($hosts, 'ip'));
?>
标签:php