3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $string = "\xe2\x82\xac"; var_dump(mb_internal_encoding()); var_dump($string); var_dump(unpack('C*', $string)); $utf8string = mb_convert_encoding($string, "UTF-8"); var_dump($utf8string); var_dump(unpack('C*', $utf8string)); mb_internal_encoding("UTF-8"); var_dump($string); var_dump($utf8string);
based on gt5H1
Output for 5.6.0 - 7.3.1
string(5) "UTF-8" string(3) "€" array(3) { [1]=> int(226) [2]=> int(130) [3]=> int(172) } string(3) "€" array(3) { [1]=> int(226) [2]=> int(130) [3]=> int(172) } string(3) "€" string(3) "€"
Output for 5.5.0 - 5.5.38
string(10) "ISO-8859-1" string(3) "€" array(3) { [1]=> int(226) [2]=> int(130) [3]=> int(172) } string(6) "€" array(6) { [1]=> int(195) [2]=> int(162) [3]=> int(194) [4]=> int(130) [5]=> int(194) [6]=> int(172) } string(3) "€" string(6) "€"