PHP mysqli_get_charset() Function
In this chapter you will learn:
- Definition for PHP mysqli_get_charset() Function
- Syntax for PHP mysqli_get_charset() Function
- Parameter for PHP mysqli_get_charset() Function
- Return for PHP mysqli_get_charset() Function
- Example - gets a character set object with its properties
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// j a v a2s. c o 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);
?>
Next chapter...
What you will learn in the next chapter:
- Definition for PHP mysqli_get_client_info() Function
- Syntax for PHP mysqli_get_client_info() Function
- Parameter for PHP mysqli_get_client_info() Function
- Return for PHP mysqli_get_client_info() Function
- Example - Get the MySQL client library version
Home » PHP Tutorial » PHP MySQLi Functions