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

ParameterIs RequiredDescription
connectionRequired.MySQL connection

Return

The returning character set object has the following properties.
ItemMeaning
charsetcharacter set name
collationcollation name
dirdirectory the charset was fetched from or ""
min_lengthmin character length in bytes
max_lengthmax character length in bytes
numberinternal character set number
statecharacter 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);
?>




















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions