dns_get_mx()

dns_get_mx() — Alias of getmxrr().

Built-in function of PHP 8.5. The manual lists it as available in PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.

dns_get_mx() is an alias of getmxrr(): same parameters, same return value.

Signature

dns_get_mx(string $hostname, array &$hosts, array &$weights = null): bool

Parameters

ParameterTypeWhat it takes
$hostnamestringThe Internet host name.
&$hostsarrayA list of the MX records found is placed into the array hosts.
&$weightsarrayIf the weights array is given, it will be filled with the weight information gathered.

Return value

Returns true if any records are found; returns false if no records were found or if an error occurred.

Example

The PHP manual ships no example for dns_get_mx(); the signature and the parameter table above are the contract.

All PHP 8.5 built-in functions

Reference card built from the PHP manual page dns_get_mx() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.