3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $str2 = "占楼"; var_dump(mb_detect_encoding($str2, 'CP936')); var_dump(mb_detect_encoding($str2, 'EUC-CN')); var_dump(mb_detect_encoding($str2, 'UTF-8'));
based on I1uZ4
Output for 4.3.4 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
string(5) "CP936" string(6) "EUC-CN" string(5) "UTF-8"
Output for 4.3.2 - 4.3.3
Warning: mb_detect_encoding(): Illegal argument in /in/mR8jL on line 4 string(5) "UTF-8" Warning: mb_detect_encoding(): Illegal argument in /in/mR8jL on line 5 string(5) "UTF-8" string(5) "UTF-8"
Output for 4.3.0 - 4.3.1
Warning: mb_detect_encoding() [http://www.php.net/function.mb-detect-encoding]: Illegal argument in /in/mR8jL on line 4 string(5) "UTF-8" Warning: mb_detect_encoding() [http://www.php.net/function.mb-detect-encoding]: Illegal argument in /in/mR8jL on line 5 string(5) "UTF-8" string(5) "UTF-8"