stream_socket_pair
Function • Params changed in PHP 8.6
Creates a pair of connected, indistinguishable socket streams.
stream_socket_pair Function synopsis
stream_socket_pair(
int $domain,
int $type,
int $protocol,
$context = null
): array|false
Parameters
$domain
Typeint
The protocol family to be used: STREAM_PF_INET,
STREAM_PF_INET6 or
STREAM_PF_UNIX
$type
Typeint
The type of communication to be used:
STREAM_SOCK_DGRAM,
STREAM_SOCK_RAW,
STREAM_SOCK_RDM,
STREAM_SOCK_SEQPACKET or
STREAM_SOCK_STREAM
$protocol
Typeint
The protocol to be used: STREAM_IPPROTO_ICMP,
STREAM_IPPROTO_IP,
STREAM_IPPROTO_RAW,
STREAM_IPPROTO_TCP or
STREAM_IPPROTO_UDP
$context
OptionalDefault valuenull
Return value
Typearray|false
Returns an array with the two socket resources on success, or
false on failure.
Changes to the stream_socket_pair Function
PHP 8.6
- Optional parameter added - #4:
$context = null
stream_socket_pair(
int $domain,
int $type,
- int $protocol
+ int $protocol,
+ $context = null
): array|false PHP 8.0
- Return type added:
array|false - Parameter type added for parameter #1 (
$domain):int - Parameter type added for parameter #2 (
$type):int - Parameter type added for parameter #3 (
$protocol):int
stream_socket_pair(
- $domain,
+ int $domain,
- $type,
+ int $type,
- $protocol
+ int $protocol
- )
+ ): array|false stream_socket_pair Function Availability
stream_socket_pair 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 | Yes |
| PHP 7.0Unsupported | Yes |
| PHP 5.6Unsupported | Yes |
| PHP 5.5Unsupported | Yes |
| PHP 5.4Unsupported | Yes |
| PHP 5.3Unsupported | Yes |