I'm looking for feedback to improve this function. The purpose is to pass a noun and append the appropriate indefinite article (a or an).A known issue with this code is that it doesn't address words with a vowel sound but a consonant first letter, such as honor or hour. I cannot include 'h' in the list of vowels, though; words like home or horror have a harder 'h' sound and use the article a.function aan ($string) {    return (        in_array(            strtolower(substr($string, 0, 1)),            array('a','e','i','o','u')        ) ? 'an' : 'a'    ).' '.$string;}Current output:print 'Become '.aan('All-access').' member'; // Become an All-access memberprint 'Become '.aan('Basic').' member'; // Become a Basic memberprint 'It has been '.aan('interesting').' experience'; // It has been an interesting experience
Indefinite article a/an
php;strings
It would be simpler to use stristr() and $string[0].function indefinite_article_heuristic($string) {    return (stristr('aeiou', $string[0]) ? 'an ' : 'a ') . $string;}stripos() would probably be slightly more efficient, but you would have to dofunction indefinite_article_heuristic($string) {    return (FALSE === stripos('aeiou', $string[0]) ? 'a ' : 'an ') . $string;}which looks icky.