PHP mysqli_character_set_name() returns the default character set for the database connection.
Syntax
string mysqli_character_set_name(connection);
Parameter | Description |
---|---|
Connection : | Required parameter. The MySQL connection to be used |
Return Values : | The default character set for the current connection. |
<?php $con = mysqli_connect("localhost","user","password","db"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $charset = mysqli_character_set_name($con); echo "Current character set is " . $charset; mysqli_close($con); ?>