[Solved] PHP – How to detect second vowel and trim the word? [closed]


Actually i didn’t get what you want but i think this might work

$yourString = "engineering";

$vowels = array("a", "e", "i", "o", "u", "A", "E", "I", "O", "U");

$occured = 0;
$output = "";
for($i=0;$i<strlen($yourString);$i++)
{
    if(in_array($yourString[$i],$vowels) && ++$occured > 2) break;
    $output .= $yourString[$i];
}

print $output;

6

solved PHP – How to detect second vowel and trim the word? [closed]