- preg_match: documentation ( source)
- strtoupper: documentation ( source)
<?php
function normalise($string) {
preg_match('~[a-z0-9]+$~i', $string, $match);
if ( ! isset($match[0])) {
return false;
}
return strtoupper($match[0]);
}
echo normalise('Deu-12345tx'), PHP_EOL;