3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $string = ''; foreach(str_split(iconv("UTF-8", "Windows-1252", "my utf8 string áéíóú")) as $n => $c) { if (! ctype_alnum($c)) { $c = '%'.bin2hex($c); } $string .= $c; } var_dump($string);
based on ZTBSt
Output for 5.3.18 - 5.5.34, 5.6.8 - 5.6.20, 5.6.28 - 7.0.5, 7.0.20 - 7.2.0
string(36) "my%20utf8%20string%20%e1%e9%ed%f3%fa"
Output for 7.0.6
Fatal error: Uncaught Error: Call to undefined function iconv() in /in/lWW1v:4 Stack trace: #0 {main} thrown in /in/lWW1v on line 4
Process exited with code 255.
Output for 5.5.35, 5.6.21
Fatal error: Call to undefined function iconv() in /in/lWW1v on line 4
Process exited with code 255.