Is there an easy way to substitute a/an in a string to agree with the following word – much the same as the way ‘S’ works in Date format?
e.g.
$apple = 'apple';
$pear = 'pear';
echo "This is a $apple, this is a $pear."
--> This is an apple, this is a pear
Try this :
output: