Change language

PHP Dns_get_mx () ​​Function

Syntax:
bool dns_get_mx ($host, $mxhosts, $weight);
Parameter :This function takes three parameters as above and described below:
  • $host:Required. It specifies the name of the host whose MX records to find.
  • $mxhosts:Required. The array specifies the MX hostnames found.
  • $weight:This is an optional parameter. An array filled with collected weight information.
Return Value:This function returns TRUE if any records are found, otherwise returns FALSE. Note.This function is available for PHP 5.0.0 and later.The following programs illustrate the dns_get_mx() ​​functionin PHP:Program 1: $domain = "engineerforengineer.org" ; if (dns_get_mx ( $domain , $mx_details )) { foreach ( $mx_details as $key = > $value ) { echo "$key = > $value
"
; } }
?>
Output:
0 = > alt3.aspmx.l.google.com 1 = > alt4.aspmx.l.google.com 2 = > aspmx.l.google.com 3 = > alt2.aspmx.l.google.com 4 = > alt1.aspmx.l.google.com
Program 2: $domain = "yahoo.com" ; if (dns_get_mx ( $domain , $mx_details )) { foreach ( $mx_details as $key = > $value ) { echo "$key = > $value
"
; } }
?>
Output:
0 = > mta5.am0.yahoodns.net 1 = > mta6.am0.yahoodns.net 2 = > mta7.am0.yahoodns.net
Link: https://www.php.net/manual/en/function.dns-get-mx.php

Shop

Best laptop for Sims 4

$

Best laptop for Zoom

$499

Best laptop for Minecraft

$590

Best laptop for engineering student

$

Best laptop for development

$

Best laptop for Cricut Maker

$

Best laptop for hacking

$890

Best laptop for Machine Learning

$950

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method