PHP mysqli_character_set_name() Function

Definition

The mysqli_character_set_name() function returns the default character set for the database connection.

Syntax

PHP mysqli_character_set_name() Function has the following syntax.

mysqli_character_set_name(connection);

Parameter

ParameterIs RequiredDescription
connectionRequired.MySQL connection

Return

The default character set for the current connection.

Example

returns the default character set for the database connection.


<?php/*from  w  ww .j  a  v  a 2s .  com*/
$con=mysqli_connect("localhost","my_user","my_password","my_db");

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

$charset=mysqli_character_set_name($con);
echo "Default character set is: " . $charset;

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