// preg_replace capitalize a letter
$str = 'JAMES "JIMMY" SMITH';
echo preg_replace_callback(
'/\b[a-z]/',
function ($matches) {
return strtoupper($matches[0]);
},
$str
);
// http://stackoverflow.com/questions/2638288/preg-replace-to-capitalize-a-letter-after-a-quote