I need to check if there's any punctuation at the end of a text string and if there are none, add a period.
The punctuations that I would expect are:
.
!
?
...
I guess I would need to trim trailing white space and then probably do something like
$punctuation = substr(trim($myStr) , -1);
if ($punctuation != '.' && $punctuation != '!' && $punctuation != '?' ) {
$myStr .= '.';
}
Wait, did I just figure it out? Seems a bit awkward though...