Function name: stream_get_transports()
Applicable version: PHP 5 >= 5.2.1, PHP 7
Function description: The stream_get_transports() function returns a list of network transmission protocols supported by the current PHP version.
Usage: stream_get_transports(void): array
Parameters: This function does not accept any parameters.
Return value: Returns an array containing the network transmission protocols supported by the current PHP version. If no protocol is available, an empty array is returned.
Example:
$transports = stream_get_transports(); foreach ($transports as $transport) { echo $transport . PHP_EOL; }
Output example:
tcp udp udg ssl sslv2 sslv3 tls tlsv1.0 tlsv1.1 tlsv1.2
This sample code takes a list of network transmission protocols supported by the current PHP version and prints them out line by line. In this example, the output results include common transmission protocols, such as tcp, udp, ssl, etc.
Please note that the specific output results may vary depending on PHP version and compilation options.