3v4l.org

run code in 300+ PHP versions simultaneously
<?php function stripAccents($string) { echo htmlentities($string, ENT_QUOTES, 'UTF-8'); return html_entity_decode(preg_replace('~&([A-Z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml|caron);~i', '$1', htmlentities($string, ENT_QUOTES, 'UTF-8')), ENT_QUOTES, 'UTF-8'); } echo stripAccents('Âécho');

preferences:
47.93 ms | 402 KiB | 5 Q