3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $param = "pc官网-baidu"; $param1 = "PC%E5%AE%98%E7%BD%91%E2%80%94360"; // echo urldecode($param1)."\n"; // $res1 = mb_convert_encoding(urldecode($param1), 'utf-8','gb2312'); // $res2 = mb_convert_encoding(urldecode($param1), 'utf-8'); // echo mb_strlen($res1, "utf-8") ,"\n", mb_strlen($res2, "utf-8"); // echo $res1,"\n",$res2; $decodeParam = urldecode($param1); $res1 = mb_convert_encoding($decodeParam, 'utf-8', 'gbk'); $res2 = mb_convert_encoding($decodeParam, 'gbk'); echo iconv("gb2312","utf-8",$decodeParam); if(mb_strlen($res1, 'utf-8') < mb_strlen($res2, 'utf-8')) { echo $res1; } else { echo $res2; } echo "\n" , $res1, "\n", $res2;
based on odIaJ
Output for 5.6.7 - 5.6.20, 5.6.28 - 7.0.5, 7.0.20 - 7.2.0
Notice: iconv(): Detected an illegal character in input string in /in/FSW9V on line 13 PC瀹樼綉鈥?60 PC瀹樼綉鈥?60 PC�����360
Output for 7.0.6
Fatal error: Uncaught Error: Call to undefined function iconv() in /in/FSW9V:13 Stack trace: #0 {main} thrown in /in/FSW9V on line 13
Process exited with code 255.
Output for 5.5.35, 5.6.21
Fatal error: Call to undefined function iconv() in /in/FSW9V on line 13
Process exited with code 255.
Output for 5.4.2 - 5.5.34
Notice: iconv(): Detected an illegal character in input string in /in/FSW9V on line 13 PC瀹樼綉鈥?60 PC瀹樼綉鈥?60 PC?????????360
Output for 5.3.18 - 5.3.29
Notice: iconv(): Detected an illegal character in input string in /in/FSW9V on line 13 PC瀹PC瀹樼綉鈥?60 PC瀹樼綉鈥?60 PC?????????360