3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $ciphers = openssl_get_cipher_methods(); $ciphers_and_aliases = openssl_get_cipher_methods(true); $cipher_aliases = array_diff($ciphers_and_aliases, $ciphers); //print_r($ciphers); //print_r($cipher_aliases); $context = stream_context_create(['ssl' => [ 'ciphers' => 'ECDHE-ECDSA-AES128-SHA' ]]); $timeout = 42; $connFlags = STREAM_CLIENT_CONNECT; // Works as before $sock = stream_socket_client('tls://github.com:443', $errno, $errstr, $timeout, $connFlags, $context); // Negotiates SSLv3, TLSv1.1 or TLSv1.2 because tls:// default is overridden by the context $context = stream_context_create(['ssl' => [ 'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT | STREAM_CRYPTO_METHOD_SSLv3_CLIENT ]]); $sock = stream_socket_client('tls://github.com:443', $errno, $errstr, $timeout, $connFlags, $context);
Output for 5.6.18 - 5.6.19, 7.0.4, 7.0.20, 7.1.5 - 7.2.0
Warning: stream_socket_client(): php_network_getaddresses: getaddrinfo failed: System error in /in/XkKiB on line 17 Warning: stream_socket_client(): unable to connect to tls://github.com:443 (php_network_getaddresses: getaddrinfo failed: System error) in /in/XkKiB on line 17 Warning: stream_socket_client(): php_network_getaddresses: getaddrinfo failed: System error in /in/XkKiB on line 23 Warning: stream_socket_client(): unable to connect to tls://github.com:443 (php_network_getaddresses: getaddrinfo failed: System error) in /in/XkKiB on line 23
Output for 5.6.8 - 5.6.17, 5.6.20 - 7.0.3, 7.0.5 - 7.0.6, 7.1.0
Warning: stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/XkKiB on line 17 Warning: stream_socket_client(): unable to connect to tls://github.com:443 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /in/XkKiB on line 17 Warning: stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/XkKiB on line 23 Warning: stream_socket_client(): unable to connect to tls://github.com:443 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /in/XkKiB on line 23
Output for 5.5.24 - 5.5.32, 5.5.34 - 5.5.35
Warning: stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/XkKiB on line 17 Warning: stream_socket_client(): unable to connect to tls://github.com:443 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /in/XkKiB on line 17 Notice: Use of undefined constant STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT - assumed 'STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT' in /in/XkKiB on line 21 Notice: Use of undefined constant STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT - assumed 'STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT' in /in/XkKiB on line 21 Warning: stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/XkKiB on line 23 Warning: stream_socket_client(): unable to connect to tls://github.com:443 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /in/XkKiB on line 23
Output for 5.4.15 - 5.4.45, 5.5.33
Warning: stream_socket_client(): php_network_getaddresses: getaddrinfo failed: System error in /in/XkKiB on line 17 Warning: stream_socket_client(): unable to connect to tls://github.com:443 (php_network_getaddresses: getaddrinfo failed: System error) in /in/XkKiB on line 17 Notice: Use of undefined constant STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT - assumed 'STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT' in /in/XkKiB on line 21 Notice: Use of undefined constant STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT - assumed 'STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT' in /in/XkKiB on line 21 Warning: stream_socket_client(): php_network_getaddresses: getaddrinfo failed: System error in /in/XkKiB on line 23 Warning: stream_socket_client(): unable to connect to tls://github.com:443 (php_network_getaddresses: getaddrinfo failed: System error) in /in/XkKiB on line 23
Output for 5.4.9 - 5.4.14
Fatal error: Call to undefined function openssl_get_cipher_methods() in /in/XkKiB on line 3
Process exited with code 255.
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected '[', expecting ')' in /in/XkKiB on line 10
Process exited with code 255.