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
| Parameter | Type | What it takes |
|---|---|---|
| $hostname | string | The Internet host name. |
| &$hosts | array | A list of the MX records found is placed into the array hosts. |
| &$weights | array | If 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.