Capitalize after point and space only the next word after point, maybe using regex + ucfirst..
preg_match('/[\s\.][a-z]/'
$theCode = str_replace(ucfirst.....
In summary is to do uppercase only in the first letter after spaço + point, in all data of the variable.
$theCode = 'babab. babab babab. bababa bababa bababa. bababa babab baba';
out:
$theCode = 'babab. Babab babab. Bababa bababa bababa. Bababa babab baba';
No matter what method I adopted, I just suggested.
Thanks