Lower case first letter of every word

How can I make the first letter of each word lowercase in a string with a lower version than PHP 5.3?

I can do it, but only with lcfirst (PHP 5 >= 5.3.0)


function lcallfirst($string)
{
$string=explode(" ",$string);
$i=0;
while($i<count($string))
{$string[$i]=lcfirst($string[$i]);
$i++;}
return implode(" ",$string);
} 

ucwords()

lcfirst is opposite of capitalize - it turns first letter into lower case, not upper case
Capitalize usually done like this ucwords(strtolower($str));

  • wrong question, sorry.
    goal is to do the opposite, is putting the first letter in lowercase only!

can any admin edit the title and change the question? it will be confusing to people who are reading it. many thanks

You want to lower case first letter of every word? What about the other letters? Should other be left unchanged?

yes, left unchanged

function lcwords($str)
{
    return preg_replace('#\\b([a-z])#ie', "strtolower($1)", $str);
}