- substr: documentation ( source)
- strpos: documentation ( source)
- substr_replace: documentation ( source)
<?php
$string = 'This is a string of words with multiple vowels.';
$len = strlen($string);
for ($i = $len; $i >= 0 ; $i--) {
if (strpos("aeiouAEIOU", substr($string, $i, 1)) !== false) {
echo substr_replace($string, "", $i, 1);
exit();
}
}
echo $string;