Returns the default character set for database connections:
<?php$con = mysqli_connect ( "localhost" , "my_user" , "my_password" , "my_db" ); // Check connection if ( mysqli_connect_errno ( $con )){ echo "Failed to connect to database: " . mysqli_connect_error (); } $charset = mysqli_character_set_name ( $con );echo "The default character set is: " . $charset ; mysqli_close ( $con ); ?>The mysqli_character_set_name() function returns the default character set for the database connection.
mysqli_character_set_name( connection ) ;
parameter | describe |
---|---|
connection | Required. Specifies the MySQL connection to use. |
Return value: | Specifies the default character set for connections. |
---|---|
PHP version: | 5+ |