3v4l.org

run code in 300+ PHP versions simultaneously
<?php $some_string = "Ку ку"; $arra_c = array("UCS-4", "UCS-4BE", "UCS-4LE", "UCS-2", "UCS-2BE", "UCS-2LE", "UTF-32", "UTF-32BE", "UTF-32LE", "UTF-16", "UTF-16BE", "UTF-16LE", "UTF-7", "UTF7-IMAP", "UTF-8", "ASCII", "EUC-JP", "SJIS", "eucJP-win", "SJIS-win", "ISO-2022-JP", "ISO-2022-JP-MS", "CP932", "CP51932", "SJIS-mac", "SJIS-Mobile#DOCOMO", "SJIS-Mobile#KDDI", "SJIS-Mobile#SOFTBANK", "UTF-8-Mobile#DOCOMO", "UTF-8-Mobile#KDDI-A", "UTF-8-Mobile#KDDI-B", "UTF-8-Mobile#SOFTBANK", "ISO-2022-JP-MOBILE#KDDI", "JIS", "JIS-ms", "CP50220", "CP50220raw", "CP50221", "CP50222", "ISO-8859-1", "ISO-8859-2", "ISO-8859-3", "ISO-8859-4", "ISO-8859-5", "ISO-8859-6", "ISO-8859-7", "ISO-8859-8", "ISO-8859-9", "ISO-8859-10", "ISO-8859-13", "ISO-8859-14", "ISO-8859-15", "byte2be", "byte2le", "byte4be", "byte4le", "BASE64", "HTML-ENTITIES", "7bit", "8bit", "EUC-CN", "CP936", "GB18030", "HZ", "EUC-TW", "CP950", "BIG-5", "EUC-KR", "UHC",// (CP949) "ISO-2022-KR", "Windows-1251",// (CP1251) "Windows-1252",// (CP1252) "CP866",// (IBM866) "KOI8-R"); foreach($arra_c as $k => $v){ var_dump(mb_convert_encoding($some_string,$v,"UTF-8" ). "-" . $v ."#". strlen(json_encode(array('message' => mb_convert_encoding($some_string,$v,"UTF-8" ))))); } //var_dump(mb_detect_encoding($some_string)); //var_dump(strlen(json_encode(array('message' => $some_string))));
Output for git.master, git.master_jit, rfc.property-hooks
string(30) "C :C-UCS-4#114" string(32) "C :C-UCS-4BE#114" string(32) "C :C-UCS-4LE#114" string(19) "C :C-UCS-2#54" string(21) "C :C-UCS-2BE#54" string(21) "C :C-UCS-2LE#54" string(31) "C :C-UTF-32#114" string(33) "C :C-UTF-32BE#114" string(33) "C :C-UTF-32LE#114" string(20) "C :C-UTF-16#54" string(22) "C :C-UTF-16BE#54" string(22) "C :C-UTF-16LE#54" string(25) "+BBoEQw +BDoEQw--UTF-7#30" string(30) "&BBoEQw- &BDoEQw--UTF7-IMAP#31" string(18) "Ку ку-UTF-8#39" string(14) "?? ??-ASCII#19" string(18) "���� �ܧ�-EUC-JP#0" string(16) "�K�� �{��-SJIS#0" string(21) "���� �ܧ�-eucJP-win#0" string(20) "�K�� �{��-SJIS-win#0" string(36) "$B','e(B $B'\'e(B-ISO-2022-JP#56" string(39) "$B','e(B $B'\'e(B-ISO-2022-JP-MS#56" string(17) "�K�� �{��-CP932#0" string(19) "���� �ܧ�-CP51932#0" string(20) "�K�� �{��-SJIS-mac#0" string(30) "�K�� �{��-SJIS-Mobile#DOCOMO#0" string(28) "�K�� �{��-SJIS-Mobile#KDDI#0" string(32) "�K�� �{��-SJIS-Mobile#SOFTBANK#0" string(32) "Ку ку-UTF-8-Mobile#DOCOMO#39" string(32) "Ку ку-UTF-8-Mobile#KDDI-A#39" string(32) "Ку ку-UTF-8-Mobile#KDDI-B#39" string(34) "Ку ку-UTF-8-Mobile#SOFTBANK#39" string(48) "$B','e(B $B'\'e(B-ISO-2022-JP-MOBILE#KDDI#56" string(28) "$B','e(B $B'\'e(B-JIS#56" string(31) "$B','e(B $B'\'e(B-JIS-ms#56" string(32) "$B','e(B $B'\'e(B-CP50220#56" string(35) "$B','e(B $B'\'e(B-CP50220raw#56" string(32) "$B','e(B $B'\'e(B-CP50221#56" string(32) "$B','e(B $B'\'e(B-CP50222#56" string(19) "?? ??-ISO-8859-1#19" string(19) "?? ??-ISO-8859-2#19" string(19) "?? ??-ISO-8859-3#19" string(19) "?? ??-ISO-8859-4#19" string(18) "�� ��-ISO-8859-5#0" string(19) "?? ??-ISO-8859-6#19" string(19) "?? ??-ISO-8859-7#19" string(19) "?? ??-ISO-8859-8#19" string(19) "?? ??-ISO-8859-9#19" string(20) "?? ??-ISO-8859-10#19" string(20) "?? ??-ISO-8859-13#19" string(20) "?? ??-ISO-8859-14#19" string(20) "?? ??-ISO-8859-15#19" string(21) "C :C-byte2be#54" string(21) "C :C-byte2le#54" string(32) "C :C-byte4be#114" string(32) "C :C-byte4le#114" Deprecated: mb_convert_encoding(): Handling Base64 via mbstring is deprecated; use base64_encode/base64_decode instead in /in/PIdQk on line 82 string(22) "0JrRgyDQutGD-BASE64#26" Deprecated: mb_convert_encoding(): Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead in /in/PIdQk on line 82 string(46) "&#1050;&#1091; &#1082;&#1091;-HTML-ENTITIES#43" string(13) "?? ??-7bit#19" string(13) "?? ??-8bit#19" string(18) "���� �ܧ�-EUC-CN#0" string(17) "���� �ܧ�-CP936#0" string(19) "���� �ܧ�-GB18030#0" string(23) "~{','e~} ~{'\'e~}-HZ#32" string(15) "?? ??-EUC-TW#19" string(14) "?? ??-CP950#19" string(17) "Ǹ�� ����-BIG-5#0" string(18) "���� �ܬ�-EUC-KR#0" string(15) "���� �ܬ�-UHC#0" string(32) "$)C,,,e ,\,e-ISO-2022-KR#57" string(20) "�� ��-Windows-1251#0" string(21) "?? ??-Windows-1252#19" string(13) "�� ��-CP866#0" string(14) "�� ��-KOI8-R#0"

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
43.51 ms | 409 KiB | 8 Q