3v4l.org

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