3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $str = "当当网"; print htmlspecialchars($str, ENT_COMPAT, 'gbk') . "\n"; print htmlspecialchars($str, ENT_QUOTES, 'gbk') . "\n"; print htmlspecialchars($str, ENT_XML1, 'UTF-8') . "\n"; print htmlspecialchars($str, ENT_XHTML, 'UTF-8') . "\n"; print htmlspecialchars($str, ENT_HTML5, 'UTF-8') . "\n"; print htmlspecialchars($str, ENT_XML1 | ENT_DISALLOWED, 'UTF-8') . "\n";
based on Chelq
Output for 5.4.0 - 5.6.28, 7.0.0 - 7.1.0
Warning: htmlspecialchars(): charset `gbk' not supported, assuming utf-8 in /in/bRieN on line 4 当当网 Warning: htmlspecialchars(): charset `gbk' not supported, assuming utf-8 in /in/bRieN on line 5 当当网 当当网 当当网 当当网 当当网
Output for hhvm-3.10.0 - 3.12.0
Fatal error: gbk is not implemented yet. in /in/bRieN on line 4
Process exited with code 255.
Output for 4.3.2 - 5.3.29
Warning: htmlspecialchars(): charset `gbk' not supported, assuming iso-8859-1 in /in/bRieN on line 4 当当网 Warning: htmlspecialchars(): charset `gbk' not supported, assuming iso-8859-1 in /in/bRieN on line 5 当当网 Notice: Use of undefined constant ENT_XML1 - assumed 'ENT_XML1' in /in/bRieN on line 6 Warning: htmlspecialchars() expects parameter 2 to be long, string given in /in/bRieN on line 6 Notice: Use of undefined constant ENT_XHTML - assumed 'ENT_XHTML' in /in/bRieN on line 7 Warning: htmlspecialchars() expects parameter 2 to be long, string given in /in/bRieN on line 7 Notice: Use of undefined constant ENT_HTML5 - assumed 'ENT_HTML5' in /in/bRieN on line 8 Warning: htmlspecialchars() expects parameter 2 to be long, string given in /in/bRieN on line 8 Notice: Use of undefined constant ENT_XML1 - assumed 'ENT_XML1' in /in/bRieN on line 9 Notice: Use of undefined constant ENT_DISALLOWED - assumed 'ENT_DISALLOWED' in /in/bRieN on line 9 Warning: htmlspecialchars() expects parameter 2 to be long, string given in /in/bRieN on line 9
Output for 4.3.0 - 4.3.1
Warning: htmlspecialchars() [http://www.php.net/function.htmlspecialchars]: charset `gbk' not supported, assuming iso-8859-1 in /in/bRieN on line 4
Process exited with code 139.