PHP – Return an array of all supported encodings with mb_list_encodings()


The mb_list_encodings() function in PHP is used to return an array of all supported encodings. This function is supported in PHP 5 or higher version.

Syntax

array mb_list_encodings()

Parameters

mb_list_encodings() takes no parameters.

Return Values

This function returns a numerically indexed array.

Errors/Exceptions

mb_list_encodings() does not produce any errors.

Example

mb_list_encodings() does not produce any errors.

<?php
   $arr= mb_list_encodings();
   var_dump($arr);
?>

Output

It will produce the following output −

array(87) { 
   [0]=> string(4) "pass"
   [1]=> string(4) "auto"
   [2]=> string(5) "wchar" 
   [3]=> string(7) "byte2be" 
   [4]=> string(7) "byte2le" 
   [5]=> string(7) "byte4be" 
   [6]=> string(7) "byte4le" 
   [7]=> string(6) "BASE64" 
   [8]=> string(8) "UUENCODE" 
   [9]=> string(13) "HTML-ENTITIES" 
   [10]=> string(16) "Quoted-Printable" 
   [11]=> string(4) "7bit" 
   [12]=> string(4) "8bit" 
   [13]=> string(5) "UCS-4" 
   [14]=> string(7) "UCS-4BE" 
   [15]=> string(7) "UCS-4LE" 
   [16]=> string(5) "UCS-2" 
   [17]=> string(7) "UCS-2BE" 
   [18]=> string(7) "UCS-2LE" 
   [19]=> string(6) "UTF-32" 
   [20]=> string(8) "UTF-32BE" 
   [21]=> string(8) "UTF-32LE" 
   [22]=> string(6) "UTF-16" 
   [23]=> string(8) "UTF-16BE" 
   [24]=> string(8) "UTF-16LE" 
   [25]=> string(5) "UTF-8" 
   [26]=> string(5) "UTF-7" 
   [27]=> string(9) "UTF7-IMAP" 
   [28]=> string(5) "ASCII" 
   [29]=> string(6) "EUC-JP" 
   [30]=> string(4) "SJIS" 
   [31]=> string(9) "eucJP-win" 
   [32]=> string(11) "EUC-JP-2004" 
   [33]=> string(8) "SJIS-win" 
   [34]=> string(18) "SJIS-Mobile#DOCOMO" 
   [35]=> string(16) "SJIS-Mobile#KDDI" 
   [36]=> string(20) "SJIS-Mobile#SOFTBANK" 
   [37]=> string(8) "SJIS-mac" 
   [38]=> string(9) "SJIS-2004" 
   [39]=> string(19) "UTF-8-Mobile#DOCOMO" 
   [40]=> string(19) "UTF-8-Mobile#KDDI-A" 
   [41]=> string(19) "UTF-8-Mobile#KDDI-B" 
   [42]=> string(21) "UTF-8-Mobile#SOFTBANK" 
   [43]=> string(5) "CP932" 
   [44]=> string(7) "CP51932" 
   [45]=> string(3) "JIS" 
   [46]=> string(11) "ISO-2022-JP" 
   [47]=> string(14) "ISO-2022-JP-MS" 
   [48]=> string(7) "GB18030" 
   [49]=> string(12) "Windows-1252" 
   [50]=> string(12) "Windows-1254"
   [51]=> string(10) "ISO-8859-1" 
   [52]=> string(10) "ISO-8859-2" 
   [53]=> string(10) "ISO-8859-3" 
   [54]=> string(10) "ISO-8859-4" 
   [55]=> string(10) "ISO-8859-5" 
   [56]=> string(10) "ISO-8859-6" 
   [57]=> string(10) "ISO-8859-7" 
   [58]=> string(10) "ISO-8859-8" 
   [59]=> string(10) "ISO-8859-9" 
   [60]=> string(11) "ISO-8859-10" 
   [61]=> string(11) "ISO-8859-13" 
   [62]=> string(11) "ISO-8859-14" 
   [63]=> string(11) "ISO-8859-15" 
   [64]=> string(11) "ISO-8859-16" 
   [65]=> string(6) "EUC-CN" 
   [66]=> string(5) "CP936" 
   [67]=> string(2) "HZ" 
   [68]=> string(6) "EUC-TW" 
   [69]=> string(5) "BIG-5" 
   [70]=> string(5) "CP950" 
   [71]=> string(6) "EUC-KR" 
   [72]=> string(3) "UHC" 
   [73]=> string(11) "ISO-2022-KR" 
   [74]=> string(12) "Windows-1251" 
   [75]=> string(5) "CP866" 
   [76]=> string(6) "KOI8-R" 
   [77]=> string(6) "KOI8-U" 
   [78]=> string(9) "ArmSCII-8" 
   [79]=> string(5) "CP850" 
   [80]=> string(6) "JIS-ms" 
   [81]=> string(16) "ISO-2022-JP-2004" 
   [82]=> string(23) "ISO-2022-JP-MOBILE#KDDI" 
   [83]=> string(7) "CP50220" 
   [84]=> string(10) "CP50220raw" 
   [85]=> string(7) "CP50221" 
   [86]=> string(7) "CP50222" 
}

Updated on: 11-Oct-2021

181 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements