3v4l.org

run code in 300+ PHP versions simultaneously
<?php function escape($data='') { $a = 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿ'; $b = 'aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyyby'; $data = utf8_decode($data); $data = utf8_encode(strtr($data, utf8_decode($a), $b)); $data = strtolower($data); $arrPre[] = " a "; $arrPre[] = " ante "; $arrPre[] = " bajo "; $arrPre[] = " con "; $arrPre[] = " de "; $arrPre[] = " desde "; $arrPre[] = " durante "; $arrPre[] = " en "; $arrPre[] = " entre "; $arrPre[] = " excepto "; $arrPre[] = " hacia "; $arrPre[] = " hasta "; $arrPre[] = " mediante "; $arrPre[] = " para "; $arrPre[] = " por "; $arrPre[] = " salvo "; $arrPre[] = " según "; $arrPre[] = " sin "; $arrPre[] = " sobre "; $arrPre[] = " tras "; $data = str_replace($arrPre," ",$data); $data = str_replace(array('\\','!','¡','/','\'','"','“','â€?','‘','’','&','º','<','>','+','¿','?',':','.',',','%'), '', $data ); $data = str_replace(" " , "-", $data ); $data = preg_replace("/[^A-Z\d\_\.\:\,\-]/i","",$data); return $data; } echo escape('médicos');

preferences:
27.93 ms | 402 KiB | 5 Q