3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $some_string = "Ку ку"; $arra_c = array( "UTF-8", "ASCII", "ISO-8859-1", "ISO-8859-2", "ISO-8859-3", "ISO-8859-4", "ISO-8859-6", "ISO-8859-7", "ISO-8859-8", "ISO-8859-9", "ISO-8859-10", "ISO-8859-13", "ISO-8859-14", "ISO-8859-15", "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 5.5.0 - 7.1.0
string(20) "Ку ку-UTF-8 # 39" string(16) "?? ??-ASCII # 19" string(21) "?? ??-ISO-8859-1 # 19" string(21) "?? ??-ISO-8859-2 # 19" string(21) "?? ??-ISO-8859-3 # 19" string(21) "?? ??-ISO-8859-4 # 19" string(21) "?? ??-ISO-8859-6 # 19" string(21) "?? ??-ISO-8859-7 # 19" string(21) "?? ??-ISO-8859-8 # 19" string(21) "?? ??-ISO-8859-9 # 19" string(22) "?? ??-ISO-8859-10 # 19" string(22) "?? ??-ISO-8859-13 # 19" string(22) "?? ??-ISO-8859-14 # 19" string(22) "?? ??-ISO-8859-15 # 19" string(25) "~{','e~} ~{'\'e~}-HZ # 32" string(17) "?? ??-EUC-TW # 19" string(16) "?? ??-CP950 # 19" string(16) "?? ??-BIG-5 # 19" string(20) "���� �ܬ�-EUC-KR # 0" string(17) "���� �ܬ�-UHC # 0" string(34) "$)C,,,e ,\,e-ISO-2022-KR # 57" string(22) "�� ��-Windows-1251 # 0" string(23) "?? ??-Windows-1252 # 19" string(15) "�� ��-CP866 # 0" string(16) "�� ��-KOI8-R # 0"
Output for 5.2.7 - 5.3.13, 5.3.15 - 5.4.45
string(20) "Ку ку-UTF-8 # 39" string(16) "?? ??-ASCII # 19" string(21) "?? ??-ISO-8859-1 # 19" string(21) "?? ??-ISO-8859-2 # 19" string(21) "?? ??-ISO-8859-3 # 19" string(21) "?? ??-ISO-8859-4 # 19" string(21) "?? ??-ISO-8859-6 # 19" string(21) "?? ??-ISO-8859-7 # 19" string(21) "?? ??-ISO-8859-8 # 19" string(21) "?? ??-ISO-8859-9 # 19" string(22) "?? ??-ISO-8859-10 # 19" string(22) "?? ??-ISO-8859-13 # 19" string(22) "?? ??-ISO-8859-14 # 19" string(22) "?? ??-ISO-8859-15 # 19" string(25) "~{','e~} ~{'\'e~}-HZ # 32" string(17) "?? ??-EUC-TW # 19" string(16) "?? ??-CP950 # 19" string(16) "?? ??-BIG-5 # 19" string(21) "���� �ܬ�-EUC-KR # 16" string(18) "���� �ܬ�-UHC # 16" string(34) "$)C,,,e ,\,e-ISO-2022-KR # 57" string(23) "�� ��-Windows-1251 # 16" string(23) "?? ??-Windows-1252 # 19" string(16) "�� ��-CP866 # 16" string(17) "�� ��-KOI8-R # 16"
Output for 5.3.14
string(20) "Ку ку-UTF-8 # 39" string(16) "?? ??-ASCII # 19" string(21) "?? ??-ISO-8859-1 # 19" string(21) "?? ??-ISO-8859-2 # 19" string(21) "?? ??-ISO-8859-3 # 19" string(21) "?? ??-ISO-8859-4 # 19" string(21) "?? ??-ISO-8859-6 # 19" string(21) "?? ??-ISO-8859-7 # 19" string(21) "?? ??-ISO-8859-8 # 19" string(21) "?? ??-ISO-8859-9 # 19" string(22) "?? ??-ISO-8859-10 # 19" string(22) "?? ??-ISO-8859-13 # 19" string(22) "?? ??-ISO-8859-14 # 19" string(22) "?? ??-ISO-8859-15 # 19" string(25) "~{','e~} ~{'\'e~}-HZ # 32" string(17) "?? ??-EUC-TW # 19" string(16) "?? ??-CP950 # 19" string(16) "?? ??-BIG-5 # 19" Warning: json_encode(): Invalid UTF-8 sequence in argument in /in/ftRiK on line 34 string(20) "���� �ܬ�-EUC-KR # 0" Warning: json_encode(): Invalid UTF-8 sequence in argument in /in/ftRiK on line 34 string(17) "���� �ܬ�-UHC # 0" string(34) "$)C,,,e ,\,e-ISO-2022-KR # 57" Warning: json_encode(): Invalid UTF-8 sequence in argument in /in/ftRiK on line 34 string(22) "�� ��-Windows-1251 # 0" string(23) "?? ??-Windows-1252 # 19" Warning: json_encode(): Invalid UTF-8 sequence in argument in /in/ftRiK on line 34 string(15) "�� ��-CP866 # 0" Warning: json_encode(): Invalid UTF-8 sequence in argument in /in/ftRiK on line 34 string(16) "�� ��-KOI8-R # 0"
Output for 5.2.2 - 5.2.6
string(20) "Ку ку-UTF-8 # 39" string(16) "?? ??-ASCII # 19" string(21) "?? ??-ISO-8859-1 # 19" string(21) "?? ??-ISO-8859-2 # 19" string(21) "?? ??-ISO-8859-3 # 19" string(21) "?? ??-ISO-8859-4 # 19" string(21) "?? ??-ISO-8859-6 # 19" string(21) "?? ??-ISO-8859-7 # 19" string(21) "?? ??-ISO-8859-8 # 19" string(21) "?? ??-ISO-8859-9 # 19" string(22) "?? ??-ISO-8859-10 # 19" string(22) "?? ??-ISO-8859-13 # 19" string(22) "?? ??-ISO-8859-14 # 19" string(22) "?? ??-ISO-8859-15 # 19" string(25) "~{','e~} ~{'\'e~}-HZ # 32" string(17) "?? ??-EUC-TW # 19" string(16) "?? ??-CP950 # 19" string(16) "?? ??-BIG-5 # 19" string(21) "���� �ܬ�-EUC-KR # 14" string(18) "���� �ܬ�-UHC # 14" string(34) "$)C,,,e ,\,e-ISO-2022-KR # 57" string(23) "�� ��-Windows-1251 # 14" string(23) "?? ??-Windows-1252 # 19" string(16) "�� ��-CP866 # 14" string(17) "�� ��-KOI8-R # 14"
Output for 5.2.0 - 5.2.1
string(20) "Ку ку-UTF-8 # 39" string(16) "?? ??-ASCII # 19" string(21) "?? ??-ISO-8859-1 # 19" string(21) "?? ??-ISO-8859-2 # 19" string(21) "?? ??-ISO-8859-3 # 19" string(21) "?? ??-ISO-8859-4 # 19" string(21) "?? ??-ISO-8859-6 # 19" string(21) "?? ??-ISO-8859-7 # 19" string(21) "?? ??-ISO-8859-8 # 19" string(21) "?? ??-ISO-8859-9 # 19" string(22) "?? ??-ISO-8859-10 # 19" string(22) "?? ??-ISO-8859-13 # 19" string(22) "?? ??-ISO-8859-14 # 19" string(22) "?? ??-ISO-8859-15 # 19" string(25) "~{','e~} ~{'\'e~}-HZ # 32" string(17) "?? ??-EUC-TW # 19" string(16) "?? ??-CP950 # 19" string(16) "?? ??-BIG-5 # 19" string(21) "���� �ܬ�-EUC-KR # 14" string(18) "���� �ܬ�-UHC # 14" string(34) "$)C,,,e ,\,e-ISO-2022-KR # 32" string(23) "�� ��-Windows-1251 # 14" string(23) "?? ??-Windows-1252 # 19" string(16) "�� ��-CP866 # 14" string(17) "�� ��-KOI8-R # 14"
Output for 5.0.0 - 5.0.5, 5.1.1 - 5.1.6
Fatal error: Call to undefined function json_encode() in /in/ftRiK on line 34
Process exited with code 255.
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/ftRiK on line 41
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: json_encode() in /in/ftRiK on line 34
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: json_encode() in /in/ftRiK on line 34
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: json_encode() in /in/ftRiK on line 34