Suppose I have a string and want to remove all the words that begin with the letter a or A.:
$string = 'Aorem ipsum adolor sit amet, consectetur dipiscing aelit.';
That's how I was thinking:
$words = explode(' ', $string);
foreach ($words as $wordA) {
if ($wordA ***starts with letter*** 'a' OR 'A') {
How to write the statement if ($wordA starts with letter a OR A) and then to remove those words from the string (maybe something like $stringB = preg_replace($wordA, ' ', $string); )? Or do otherwise?
Thanks!