Current Location: Home> Function Categories> mb_internal_encoding

mb_internal_encoding

Set/get internal character encoding
Name:mb_internal_encoding
Category:Multi-byte string
Programming Language:php
One-line Description:Set the internal character encoding of the current script

Function name: mb_internal_encoding()

Applicable version: PHP 4 >= 4.0.6, PHP 5, PHP 7

Function description: mb_internal_encoding() function is used to set the internal character encoding of the current script.

Usage: mb_internal_encoding(string $encoding = mb_internal_encoding()): bool

parameter:

  • $encoding: Optional parameter, indicating the character encoding to be set. If this parameter is not provided, the current internal character encoding is returned.

Return value: Return true if the internal character encoding is successfully set. Return false if invalid character encoding is provided, or character encoding cannot be set.

Example:

  1. Get the current internal character encoding: $currentEncoding = mb_internal_encoding(); echo "The current internal character encoding is: ". $currentEncoding;

  2. Set the internal character encoding to UTF-8: $result = mb_internal_encoding("UTF-8"); if ($result) { echo "Internal character encoding has been successfully set to UTF-8"; } else { echo "Unable to set internal character encoding"; }

Similar Functions
Popular Articles