Don't think he wants to remove them, just identify them.
Do you want to include accented characters like â? If so, should they be listed separately or slugified (â,à etc = a, ô etc = o).
Are the vowels supposed to be case-sensitive?
$text = 'Hi AlaôyÖ! know the way to K\'ôêìlp';
$text = strtolower(preg_replace('~[^-\w]+~', '', iconv('utf-8', 'us-ascii//TRANSLIT', $text)));
$check = array('a','e','i','o','u');
foreach($check as $chk){
if(strpos($text,$chk) !== false){
$ans[] = $chk;
}
}
if(isset($ans)){
$comment = "Vowels in this string: " . implode(", ",$ans);
}else{
$comment = "No vowels were found in this string";
}
echo $comment;
diafol
Rhod Gilbert Fan (ardav)
7,796 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080