socket_addrinfo_lookup
Get array with contents of getaddrinfo about the given hostname.
socket_addrinfo_lookup Function synopsis
socket_addrinfo_lookup(
string $host,
?string $service = null,
array $hints = [],
&$error_code = null
): array|false
Parameters
$host
Typestring
Hostname to search.
$service
OptionalType?stringDefault valuenull
The service to connect to. If service is a numeric string, it designates the port. Otherwise it designates a network service name, which is mapped to a port by the operating system.
$hints
OptionalTypearrayDefault value[]
Hints provide criteria for selecting addresses returned. You may specify the hints as defined by getaddrinfo.
$error_code
Passed by reference, OptionalDefault valuenull
Note that the parameter
$error_codeis passed by reference, and contains additional/updated context data that may be useful.
Return value
Typearray|false
Returns an array of AddressInfo instances that can be used with
the socket_addrinfo_* family of functions.
On failure, false is returned.
Changes to the socket_addrinfo_lookup Function
PHP 8.6
- Optional parameter added - #4:
&$error_code = null
socket_addrinfo_lookup(
string $host,
?string $service = null,
- array $hints = []
+ array $hints = [],
+ &$error_code = null
): array|false PHP 8.0
- Return type added:
array|false - Parameter type added for parameter #1 (
$host):string - Parameter type added for parameter #2 (
$service):?string - Parameter default value added for position #2 (
$service):null - Parameter type added for parameter #3 (
$hints):array - Parameter default value added for position #3 (
$hints):[]
socket_addrinfo_lookup(
- $host,
+ string $host,
- $service,
+ ?string $service = null,
- $hints
+ array $hints = []
- )
+ ): array|false PHP 7.2
- Function added
socket_addrinfo_lookup Function Availability
socket_addrinfo_lookup Function Availability| PHP Version | Availability |
|---|---|
| PHP 8.6Upcoming Release | Yes |
| PHP 8.5Supported (Latest) | Yes |
| PHP 8.4Supported | Yes |
| PHP 8.3Security-Fixes Only | Yes |
| PHP 8.2Security-Fixes Only | Yes |
| PHP 8.1Unsupported | Yes |
| PHP 8.0Unsupported | Yes |
| PHP 7.4Unsupported | Yes |
| PHP 7.3Unsupported | Yes |
| PHP 7.2Unsupported | Yes |
| PHP 7.1Unsupported | No |
| PHP 7.0Unsupported | No |
| PHP 5.6Unsupported | No |
| PHP 5.5Unsupported | No |
| PHP 5.4Unsupported | No |
| PHP 5.3Unsupported | No |