3v4l.org

run code in 300+ PHP versions simultaneously
<?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);
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.30, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.29, 8.2.0 - 8.2.21, 8.3.0 - 8.3.9
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 4.3.3 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 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) "€"
Output for 4.3.0 - 4.3.2
string(4) "pass" 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) "€"

preferences:
292.8 ms | 402 KiB | 450 Q