I need to replace every occurrence of one of the letters a
,o
,i
,e
,u
with [aoieu]?
I tried to do the following:
str_replace(array('a', 'o', 'i', 'e', 'u'), '[aoieu]?', $input);
But when giving it input of black
instead of giving me the expected bl[aoieu]?ck
it gave me
bl[a[ao[aoi[aoie[aoieu]?]?[aoieu]?]?[aoie[aoieu]?]?[aoieu]?]?[aoi[aoie[aoieu]?]?[aoieu]?]?[aoie[aoieu]?]?[aoieu]?]?ck
How can I get it to not replace things it already replaced?