Current Location: Home> Function Categories> mb_list_encodings

mb_list_encodings

Returns all supported encoded arrays
Name:mb_list_encodings
Category:Multi-byte string
Programming Language:php
One-line Description:Returns a list of all available character encodings

Function name: mb_list_encodings()

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

Function Description: The mb_list_encodings() function is used to return a list of all available character encodings.

Usage example:

 // 获取所有可用的字符编码列表$encodings = mb_list_encodings(); // 打印字符编码列表foreach ($encodings as $encoding) { echo $encoding . "\n"; }

Example explanation:

In the above example code, we first call mb_list_encodings() function to get all available character encoding lists and assign the result to the variable $encodings . We then loop through the $encodings array using foreach and print out each character encoding.

Notes:

  • mb_list_encodings() function returns an array containing all available character encodings. These character encodings can be used for parameters of multibyte string processing functions such as mb_convert_encoding() .
  • This function is available in PHP version 4.0.6 and above.
  • If your PHP environment does not enable the mbstring extension, the function cannot be used. Make sure the mbstring extension is installed and enabled correctly.
  • For more details, see the documentation in the PHP manual: mb_list_encodings()
Similar Functions
Popular Articles