我们有一些字符串$text="Here are some text. The word is inside of the second sentence.";
和$word="word";
如何获取$sentence="The word is inside of the second sentence";
- 包含的第一句话" ".$word." "
当然应该做一些假设。其中之一是所有句子都以".\r\n"
or"!\r\n"
或 or". "
结尾"! "
。
PS我们确定strpos($text," ".$word." ")!==false