3v4l.org

run code in 300+ PHP versions simultaneously
<?php mb_internal_encoding('UTF-8'); $value = 'g' . chr(0xa4) .'eld'; $orignalValue = $value; mb_substitute_character('entity'); $value = mb_convert_encoding($value, 'UTF-8', mb_detect_encoding($value)); var_dump($value, mb_strlen($value));
Output for 8.3.0 - 8.3.6
string(5) "g?eld" int(5)
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
Fatal error: Uncaught ValueError: mb_convert_encoding(): Argument #3 ($from_encoding) must specify at least one encoding in /in/gYBGW:10 Stack trace: #0 /in/gYBGW(10): mb_convert_encoding('g\xA4eld', 'UTF-8', '') #1 {main} thrown in /in/gYBGW on line 10
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Warning: mb_convert_encoding(): Illegal character encoding specified in /in/gYBGW on line 10 string(5) "g?eld" int(5)
Output for 5.2.5 - 5.2.17, 5.3.0 - 5.3.29
Warning: mb_convert_encoding(): Illegal character encoding specified in /in/gYBGW on line 10 string(4) "geld" int(4)
Output for 4.3.4 - 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.4
Warning: mb_substitute_character(): Unknown character. in /in/gYBGW on line 8 Warning: mb_convert_encoding(): Illegal character encoding specified in /in/gYBGW on line 10 string(4) "geld" int(4)
Output for 4.3.2 - 4.3.3
Warning: mb_substitute_character(): Unknown character. in /in/gYBGW on line 8 string(7) "g、eld" int(5)
Output for 4.3.0 - 4.3.1
Warning: mb_substitute_character() [http://www.php.net/function.mb-substitute-character]: Unknown character. in /in/gYBGW on line 8 string(7) "g、eld" int(5)

preferences:
300.19 ms | 402 KiB | 457 Q