PHP mysqli_get_charset() Function
Definition
The mysqli_get_charset() function returns a character set object.
Syntax
PHP mysqli_get_charset() Function has the following syntax.
mysqli_get_charset(connection);
Parameter
Parameter | Is Required | Description |
---|---|---|
connection | Required. | MySQL connection |
Return
The returning character set object has the following properties.
Item | Meaning |
---|---|
charset | character set name |
collation | collation name |
dir | directory the charset was fetched from or "" |
min_length | min character length in bytes |
max_length | max character length in bytes |
number | internal character set number |
state | character set status |
Example
The following code gets a character set object with its properties.
<?php//ww w . j a va 2 s . co m
$con=mysqli_connect("localhost","my_user","my_password","my_db");
if (mysqli_connect_errno($con)){
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
var_dump(mysqli_get_charset($con));
mysqli_close($con);
?>