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(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(17) "?? ??-EUC-TW # 19" string(16) "?? ??-CP950 # 19" string(16) "?? ??-BIG-5 # 19" string(23) "?? ??-Windows-1252 # 19"
Output for 5.0.0 - 5.0.5, 5.1.1 - 5.1.6
Fatal error: Call to undefined function json_encode() in /in/C3QV6 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/C3QV6 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/C3QV6 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/C3QV6 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/C3QV6 on line 28