preg_split()
文字列から文の配列を取得するために使用しています。
$sentences = preg_split("/([.?!\r\n]+)/", $text, 0, PREG_SPLIT_NO_EMPTY|PREG_SPLIT_DELIM_CAPTURE);
ただし、$text
「&」が含まれている場合、たとえば次のようになります。
$text = 'this is test. we are testing this & we are over.';
その後、「&」の後に一致を停止します。