PHP mysqli_get_host_info() Function

PHP mysqli_get_host_info() function returns a string representing the type of connection used including the MySQL server hostname.

Syntax

string mysqli_get_host_info(connection);

mysqli_get_host_info() Function Parameter

ParameterDescription
Connection :Required parameter. The MySQL connection to be used.

mysqli_get_host_info() Function Return Value

Return Values :Returns a character string representing the server hostname and the connection type.

mysqli_get_host_info() Function Example

<?php
$con = mysqli_get_charset("localhost","user","password","db");

if (mysqli_connect_errno())
{
	echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

// Get host information
echo mysqli_get_host_info($con);

?>