Documentation Home
MySQL PHP API
Download this Manual
PDF (US Ltr) - 2.4Mb
PDF (A4) - 2.4Mb
HTML Download (TGZ) - 247.4Kb
HTML Download (Zip) - 254.9Kb


MySQL PHP API  /  ...  /  mysqli::$protocol_version, mysqli_get_proto_info

3.9.22 mysqli::$protocol_version, mysqli_get_proto_info

Copyright 1997-2018 the PHP Documentation Group.

  • mysqli::$protocol_version

    mysqli_get_proto_info

    Returns the version of the MySQL protocol used

Description

Object oriented style

string mysqli->protocol_version ;

Procedural style

int mysqli_get_proto_info(mysqli link);

Returns an integer representing the MySQL protocol version used by the connection represented by the link parameter.

Parameters

link

Procedural style only: A link identifier returned by mysqli_connect or mysqli_init

Return Values

Returns an integer representing the protocol version.

Examples

Example 3.50 $mysqli->protocol_version example

Object oriented style

<?php
$mysqli = new mysqli("localhost", "my_user", "my_password");

/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}

/* print protocol version */
printf("Protocol version: %d\n", $mysqli->protocol_version);

/* close connection */
$mysqli->close();
?>

Procedural style

<?php
$link = mysqli_connect("localhost", "my_user", "my_password");

/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}

/* print protocol version */
printf("Protocol version: %d\n", mysqli_get_proto_info($link));

/* close connection */
mysqli_close($link);
?>

The above examples will output:


Protocol version: 10


See Also

mysqli_get_host_info


User Comments
User comments in this section are, as the name implies, provided by MySQL users. The MySQL documentation team is not responsible for, nor do they endorse, any of the information provided here.
Sign Up Login You must be logged in to post a comment.