English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The mysqli_get_client_info() function returns the version of the MySQL client library.
mysqli_get_client_info()The function is used to obtain information about the underlying MySQL client (version).
mysqli_get_client_info([$con]);
Serial Number | Parameters and Description |
---|---|
1 | con (optional) This is an object representing the connection to the MySQL Server. |
The mysqli_get_client_info() function returns a string representing the version of the underlying MySQL client library.
This function was originally introduced in PHP version5introduced and can be used in all higher versions.
The following examples demonstratemysqli_get_client_info()Function Usage (Procedural Style)-
<?php $info = mysqli_get_client_info(); print("Client library version: " . $info); ?>
Output Result
Client library version: mysqlnd 7.4.5
In object-oriented style, the syntax of this function is$con-> client_info. The following is an example of the function in object-oriented style-
<?php //Establish Connection $con = new mysqli("localhost", "root", "password", "mydb"); //Client library version $info = $con-> client_info; print("Client library version: " . $info); //Close Connection $con -> close(); ?>
Output Result
Client library version: mysqlnd 7.4.5
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 $info = mysqli_get_client_info($con); print("Client library version: " . $info); //Close Connection mysqli_close($con); ?>
Output Result
Client library version: mysqlnd 7.4.5
Return MySQL client library version:
<?php $connection_mysql = mysqli_connect("localhost","user","password","mydb"); if (mysqli_connect_errno($connection_mysql)){ echo "Unable to connect to MySQL: " . mysqli_connect_error(); } print_r(mysqli_get_client_info($connection_mysql)); mysqli_close($connection_mysql); ?>
Output Result
mysqlnd 7.4.5