- trim: documentation ( source)
- strtoupper: documentation ( source)
- preg_replace: documentation ( source)
<?php
$text = "Test éest";
$text = preg_replace('~[^\\pL\d]+~u', '-', $text);
$text = trim($text, '-');
$text = iconv('UTF-8','ASCII//TRANSLIT', $text);
$text = strtoupper($text);
$text = preg_replace('~[^-\w]+~', '', $text);
echo strtoupper($text);