If you want something like:
"The QuiCK BRown Fox juMPs" -> "The Quick Brown Fox Jumps" you can use this:
<?php
$string = ""The QuiCK BRown Fox juMPs"";
$tmp = explode(" +",$string);
$new = "";
foreach($tmp as $t){
$new[] = ucfirst(strtolower($t));
}
$string2 = implode(" ",$new);
print $string2;
I don't have a machine to test this on, but you get the gist.