this is the code i have so far
function capitals($text2)
{
$_words = explode (" ",$text2);
$result = " ";
for ($c=0; $c<sizeof($_words); $c++)
{
if (strlen(str_replace("."," ",$_words[$c]))%2)
{
$trim = str_replace("."," ",$_words[$c]);
$pos = round (count (strlen (str_replace("."," ".$_words[$c]) ) /2) );
$letter = strtoupper(substr($_words[$c],$pos,1));
$new = substr($_words[$c],0,$pos-1).substr_replace($_words[$c],$letter,$pos).substr($_words[$c],$pos+1);
$result .= $new." ";
}
else
{
$result .= $_words[$c]." ";
}
}
return $result;
}
however, it is not capitalizing the middle letter but the one before it on words longer than 3 letters… can anyone help?