有没有一种简单的方法可以替换字符串中的 a/an 以与后面的单词一致 - 与日期格式中“S”的工作方式非常相似?
e.g.
$apple = 'apple';
$pear = 'pear';
echo "This is a $apple, this is a $pear."
--> This is an apple, this is a pear
看看这个,它通过了我自己的测试,看起来相当可靠。
https://github.com/Kaivosukeltaja/php-indefinite-article https://github.com/Kaivosukeltaja/php-indefinite-article
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)