never knew about the ucfirst command existed, but my way of doing it would have been
PHP Code:
foreach ($exploded as $e) {
if($three == "yes") {
$e = strtoupper($e);
$one = "";
$two = "";
$three = "";
}
if (($two == "yes") && ($e == " ")) {
$three = "yes";
}
if (($one == "yes") && ($e == " ")) {
$two = "yes";
}
if($e == "." || $e == "?" || $e == "!") {
$one = "yes"
}
}