3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str="I am a string with several periods.period #1. period #2. period #3"; preg_match_all("/\.\s*\w/", $str, $matches); $matches[0] = array_unique($matches[0]); foreach($matches[0] as $match){ $str = str_replace($match, strtoupper($match), $str); } echo $str;

preferences:
15.75 ms | 402 KiB | 5 Q