the code below used php functions to get me MX hostnames and their just ip version 4:
$results = dns_get_record($domain, DNS_MX);
foreach ($results as $res) {
$hostip = gethostbyname($res['target']);
}
i googled a lot about 'dig' and found "dig -t MX redhat.com +noall +answer" but it returns just the MX hostnames without their IPV4 and IPV6. Is there a way to get the job done using "dig" or PHP Functions?