This is what you would expect php to deliver if there was a built-in function named ucsentence.
function ucsentence ($string){
$string = explode ('.', $string);
$count = count ($string);
for ($i = 0; $i < $count; $i++){
$string[$i] = ucfirst (trim ($string[$i]));
if ($i > 0){
$string[$i] = ' ' . $string[$i];
}
}
$string = implode ('.', $string);
return $string;
}