- preg_match_all: documentation ( source)
- str_replace: documentation ( source)
- strtoupper: documentation ( source)
<?php
$str="I am a string with several periods.period #1. period #2.";
preg_match_all("/\.\s*\w/", $str, $matches);
foreach($matches[0] as $match){
$str = str_replace($match, strtoupper($match), $str);
}
echo $str;