We have this code that grabs the first two sentences of a paragraph and it works perfect except for the fact that it only counts periods. It needs to get the first two sentences even if they have exclamation points or question marks. This is what we are currently using:
function createCustomDescription($string) {
$strArray = explode('.',$string);
$custom_desc = $strArray[0].'.';
$custom_desc .= $strArray[1].'.';
return htmlspecialchars($custom_desc);
}
Any ideas how to also check for question marks and/or exclamation points?