3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $name = '管理者'; $formatter = new MessageFormatter('en_US', 'Hi {name}!'); var_dump($formatter->format(['name' => $name])); var_dump($formatter->getErrorMessage()); $name = mb_convert_encoding($name, 'EUC-JP'); var_dump($formatter->format(['name' => $name])); var_dump($formatter->getErrorMessage());
Output for 5.6.8 - 5.6.12, 5.6.16 - 5.6.19, 5.6.21 - 7.0.4, 7.0.6 - 7.2.0
string(13) "Hi 管理者!" string(12) "U_ZERO_ERROR" bool(false) string(69) "Invalid UTF-8 data in string argument: '�����': U_INVALID_CHAR_FOUND"
Output for 7.0.5
Fatal error: Uncaught Error: Class 'MessageFormatter' not found in /in/jOWCt:3 Stack trace: #0 {main} thrown in /in/jOWCt on line 3
Process exited with code 255.
Output for 5.5.29 - 5.5.30, 5.5.34, 5.6.13 - 5.6.15, 5.6.20
Fatal error: Class 'MessageFormatter' not found in /in/jOWCt on line 3
Process exited with code 255.
Output for 5.5.24 - 5.5.28, 5.5.31 - 5.5.33, 5.5.35
string(13) "Hi 管理者!" string(12) "U_ZERO_ERROR" bool(false) string(82) "Invalid UTF-8 data in string argument: '�������??���??': U_INVALID_CHAR_FOUND"
Output for 5.4.11 - 5.4.45
string(10) "Hi {name}!" string(12) "U_ZERO_ERROR" string(10) "Hi {name}!" string(12) "U_ZERO_ERROR"
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[', expecting ')' in /in/jOWCt on line 5
Process exited with code 255.