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", "EUC-TW", "CP950", "BIG-5", "Windows-1252",// (CP1252) ); 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.2.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
string(173) "Моё первое уведомление для слоупоков аххахахахахахах вот как-то так, надеюсь оно дойдёт-UTF-8 # 471" string(99) "??? ?????? ??????????? ??? ????????? ??????????????? ??? ???-?? ???, ??????? ??? ??????-ASCII # 101" string(104) "??? ?????? ??????????? ??? ????????? ??????????????? ??? ???-?? ???, ??????? ??? ??????-ISO-8859-1 # 101" string(104) "??? ?????? ??????????? ??? ????????? ??????????????? ??? ???-?? ???, ??????? ??? ??????-ISO-8859-2 # 101" string(104) "??? ?????? ??????????? ??? ????????? ??????????????? ??? ???-?? ???, ??????? ??? ??????-ISO-8859-3 # 101" string(104) "??? ?????? ??????????? ??? ????????? ??????????????? ??? ???-?? ???, ??????? ??? ??????-ISO-8859-4 # 101" string(104) "??? ?????? ??????????? ??? ????????? ??????????????? ??? ???-?? ???, ??????? ??? ??????-ISO-8859-6 # 101" string(104) "??? ?????? ??????????? ??? ????????? ??????????????? ??? ???-?? ???, ??????? ??? ??????-ISO-8859-7 # 101" string(104) "??? ?????? ??????????? ??? ????????? ??????????????? ??? ???-?? ???, ??????? ??? ??????-ISO-8859-8 # 101" string(104) "??? ?????? ??????????? ??? ????????? ??????????????? ??? ???-?? ???, ??????? ??? ??????-ISO-8859-9 # 101" string(105) "??? ?????? ??????????? ??? ????????? ??????????????? ??? ???-?? ???, ??????? ??? ??????-ISO-8859-10 # 101" string(105) "??? ?????? ??????????? ??? ????????? ??????????????? ??? ???-?? ???, ??????? ??? ??????-ISO-8859-13 # 101" string(105) "??? ?????? ??????????? ??? ????????? ??????????????? ??? ???-?? ???, ??????? ??? ??????-ISO-8859-14 # 101" string(105) "??? ?????? ??????????? ??? ????????? ??????????????? ??? ???-?? ???, ??????? ??? ??????-ISO-8859-15 # 101" string(100) "??? ?????? ??????????? ??? ????????? ??????????????? ??? ???-?? ???, ??????? ??? ??????-EUC-TW # 101" string(99) "??? ?????? ??????????? ??? ????????? ??????????????? ??? ???-?? ???, ??????? ??? ??????-CP950 # 101" string(99) "??? ?????? ??????????? ??? ????????? ??????????????? ??? ???-?? ???, ??????? ??? ??????-BIG-5 # 101" string(106) "??? ?????? ??????????? ??? ????????? ??????????????? ??? ???-?? ???, ??????? ??? ??????-Windows-1252 # 101"
Output for 5.0.0 - 5.0.5, 5.1.1 - 5.1.6
Fatal error: Call to undefined function json_encode() in /in/MhiUh on line 28
Process exited with code 255.
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/MhiUh on line 35
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: json_encode() in /in/MhiUh on line 28
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: json_encode() in /in/MhiUh on line 28
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: json_encode() in /in/MhiUh on line 28