Is there a reliable and cross-platform method in PHP to verify if a web server supports SSL/HTTPS connections?

To verify if a web server supports SSL/HTTPS connections in PHP, you can use the `stream_socket_client` function with the `STREAM_CRYPTO_METHOD_TLS_CLIENT` flag. This function will attempt to establish an SSL/TLS connection with the server, and if successful, it means that the server supports SSL/HTTPS connections.

$context = stream_context_create([
    'ssl' => [
        'crypto_method' => STREAM_CRYPTO_METHOD_TLS_CLIENT
    ]
]);

$socket = stream_socket_client('ssl://example.com:443', $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $context);

if ($socket) {
    echo 'SSL/HTTPS is supported';
    fclose($socket);
} else {
    echo 'SSL/HTTPS is not supported';
}