3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $str = "don&#39;t-break-me-überÆØÅ!"; print htmlspecialchars_decode($str, ENT_QUOTES) . PHP_EOL; print html_entity_decode($str, ENT_QUOTES) . PHP_EOL; print html_entity_decode($str, ENT_QUOTES, 'ISO-8859-1') . PHP_EOL; print html_entity_decode($str, ENT_QUOTES | ENT_XML1, 'ISO-8859-1') . PHP_EOL; print html_entity_decode($str, ENT_QUOTES, 'UTF-8') . PHP_EOL; // Decode ALL entities (double quotes (&#34;), // single quotes (&#39; + &apos;) and non printable chars (e.g. &#13;)) print html_entity_decode($str, ENT_QUOTES | ENT_XML1, 'UTF-8') . PHP_EOL; // Convert &#[0-9]+ entities to UTF-8 $new = preg_replace_callback("/(&#[0-9]+;)/", function($m) { return mb_convert_encoding($m[1], "UTF-8", "HTML-ENTITIES"); }, $str); print $new . PHP_EOL; // Convert &#[0-9]+ entities to ISO-8859-1 $new2 = preg_replace_callback("/(&#[0-9]+;)/", function($m) { return mb_convert_encoding($m[1], "ISO-8859-1", "HTML-ENTITIES"); }, $str); print $new2 . PHP_EOL;
based on 27kar
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.2.6
don't-break-me-überÆØÅ! don't-break-me-überÆØÅ! don't-break-me-überÆØÅ! don't-break-me-überÆØÅ! don't-break-me-überÆØÅ! don't-break-me-überÆØÅ! don't-break-me-überÆØÅ! don't-break-me-überÆØÅ!
Output for hhvm-3.15.4
don't-break-me-überÆØÅ! don't-break-me-überÆØÅ! don't-break-me-überÆØÅ! don&#39;t-break-me-überÆØÅ! don't-break-me-überÆØÅ! don't-break-me-überÆØÅ! don't-break-me-überÆØÅ! don't-break-me-überÆØÅ!