3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php echo "Coss&eacute"; echo utf8_decode("Coss&eacute"); echo iconv("ASCII","UTF-8//TRANSLIT","Coss&eacute"); $in_utf8encoded = "é à ù è ò"; // first you need the convert the string to the charset you want... $in_iso8859encoded = iconv("UTF-8", "ISO-8859-1", $in_utf8encoded); // ...in order to make htmlentities work with the same charset $out_iso8859= htmlentities($in_iso8859encoded, ENT_COMPAT, "ISO-8859-1"); // then only to display in your page, revert it back to utf-8 echo iconv("ISO-8859-1", "UTF-8", $out_iso8859);
based on TsYFD
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
Coss&eacuteCoss&eacuteCoss&eacute&eacute; &agrave; &ugrave; &egrave; &ograve;
Output for 7.0.6
Coss&eacuteCoss&eacute Fatal error: Uncaught Error: Call to undefined function iconv() in /in/rCPI2:4 Stack trace: #0 {main} thrown in /in/rCPI2 on line 4
Process exited with code 255.
Output for 5.5.35, 5.6.21
Coss&eacuteCoss&eacute Fatal error: Call to undefined function iconv() in /in/rCPI2 on line 4
Process exited with code 255.