English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
mysqli_get_client_version()The function returns the version of the MySQL client as an integer.
mysqli_get_client_version($con);
Serial Number | Parameters and Description |
---|---|
1 | con(Required) This is an object representing the connection to the MySQL Server. |
The mysqli_get_client_version() function returns an integer representing the MySQL client library version.
This function was originally introduced in PHP version5introduced and can be used in all higher versions.
The following examples demonstratemysqli_get_client_version()Function usage (procedural style), returns the client library version number:
<?php //Client library version $version = mysqli_get_client_version(); print("Client library version number: "$version"); ?>
Output Result
Client library version number: 70405
In the object-oriented style, the syntax of this function is$con-> client_version. Here is an example of the function in an object-oriented style-
<?php //Establish Connection $con = new mysqli("localhost", "root", "password", "mydb"); //Client library version number $version = $con-> client_version; print("Client library version number: "$version"); //Close Connection $con -> close(); ?>
Output Result
Client library version number: 70405
Now let's try to call this function by passing an optional parameter (connection object)-
<?php //Establish Connection $con = mysqli_connect("localhost", "root", "password", "mydb"); //Client library version number $version = mysqli_get_client_version($con); print("Client library version number: "$version"); //Close Connection mysqli_close($con); ?>
Output Result
Client library version number: 70405
Return the MySQL client library version as an integer:
<?php $connection_mysql = mysqli_connect("localhost", "root", "password", "mydb"); if (mysqli_connect_errno($connection_mysql)){ print("Connection to MySQL failed: ".mysqli_connect_error()); } print(mysqli_get_client_version($connection_mysql)); mysqli_close($connection_mysql); ?>
Output Result
70405