checkdnsrr()

checkdnsrr() — Check DNS records corresponding to a given Internet host name or IP address.

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

checkdnsrr(string $hostname, string $type = "MX"): bool

Parameters

ParameterTypeWhat it takes
$hostnamestringhostname may either be the IP address in dotted-quad notation or the host name.
$typestringtype may be any one of: A, MX, NS, SOA, PTR, CNAME, AAAA, A6, SRV, NAPTR, TXT or ANY.

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

See also

dns_get_record(), getmxrr(), gethostbyaddr(), gethostbyname(), gethostbynamel()

All PHP 8.5 built-in functions

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