3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = 'This is a string of words with multiple vowels.'; $words = explode(" ", $string); $lastword = array_pop($words); $vowels = array("a", "e", "i", "o", "u", "A", "E", "I", "O", "U", " "); $newlastword = str_replace($vowels, "", $lastword); $newstring=''; foreach ($words as $value) { $newstring=$newstring.$value; } $newstring=$newstring.$newlastword; echo $newstring;

preferences:
40.79 ms | 402 KiB | 5 Q