I have some difficulties understanding preg_replace.
Right now I have the following code:
<?php
$var = 'volkswagen-golf-gti';
$var2 = ucwords(str_replace('-', ' ', $var));
$var2 = preg_replace("/\s+\S+$/e", "strtoupper('\\1')", $var2);
echo $var2;
?>
This code is only removing the last part of $var
so echo $var2 gives me "Volkswagen Golf"
How can I change the code so it select the last part of $var and make it uppercase with strtoupper? So the result of echo $var2; will be "Volkswagen Golf GTI"?
ps $var can be anything, not only volkswagen-golf-gti