ok basically this function is meant to capitalise text properly, so given "HELLO THERE" it should return "Hello There". however what is being returned is "hello there". what am i missing? many thanks. code is probably big mess ^^
function prettyfyText($text){
$text = strtolower($text);
$explode = explode(" ", $text);
$i = 0;
while($i < count($explode)) {
$string = str_split($explode[$i]);
$idx = 0;
while($idx<count($string)){
if($idx == 0) {
$string[$idx] = strtoupper($string[$idx]);
}
$idx++;
//echo $string[0]." ".$string[1]."<br />";
$nice = implode("", $string);
}
$blah = implode(" ", $explode);
$i++;
}
echo $blah;
} // end function prettyfyText