3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "Doplňkové služby"; $e = htmlentities($str, ENT_COMPAT, "UTF-8"); $d = html_entity_decode($e, ENT_COMPAT, "UTF-8"); print_r($e); echo "\n"; print_r($d); echo "\n\n"; $ee = _decodeAccented($e); print_r($ee); function _decodeAccented($encodedValue, $options = array()) { $options += array( 'quote' => ENT_NOQUOTES, 'encoding' => 'UTF-8', ); return preg_replace_callback( '/&\w(acute|uml|tilde);/', create_function( '$m', 'return html_entity_decode($m[0], ' . $options['quote'] . ', "' . $options['encoding'] . '");' ), $encodedValue ); }

preferences:
48.3 ms | 402 KiB | 5 Q