getmxrr()

getmxrr() — Get MX records corresponding to a given Internet host name.

Built-in function of PHP 8.5. The manual lists it as available in PHP 4, 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.

Signature

getmxrr(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 getmxrr(); the signature and the parameter table above are the contract.

See also

checkdnsrr(), dns_get_record(), gethostbyname(), gethostbynamel(), gethostbyaddr()

All PHP 8.5 built-in functions

Reference card built from the PHP manual page getmxrr() (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.