This function is a bit more flexible than using mb_convert_case with MB_CASE_TITLE, because it lets you add words whose case you don't want modified.
function title_case($string, $exceptions = array('to', 'a', 'the', 'of', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X')) {
$words = split(" ", $string);
$newwords = array();
foreach ($words as $word)
{
if (!array_key_exists($word, $exceptions)) {
$word = strtolower($word);
$word = ucfirst($word);
}
array_push($newwords, $word);
}
return ucfirst(join(" ", $newwords));
}