【发布时间】:2016-12-21 20:56:43
【问题描述】:
我知道如何使用 strpos 查找子字符串,但我只想在字母 t 出现在字符串中时返回 True,但如果 t 后跟“he”则不返回。例如...
$str="The lion and dog are hungry"
结果将是Does not contain t,因为字符串中唯一的 t 是单词“The”的一部分。
$str="Their bedroom is ugly" 也应该返回 false,因为 "Their" 以 T H E 开头并且字符串中没有其他 t。
$str="The cat and the dog are hungry" 将导致 Yes, this string contains a t,因为 CAT 中有一个 t。
【问题讨论】: