Jeremy R Irawan Jeremy R Irawan - 6 months ago 15
PHP Question

PHP returning a string with the first char of every words in lowercase

There is already a function in PHP called ucwords which does just the opposite of what i need.

Is there such php library called lcwords? where instead of capitalizing the first of every words it converts them to lower case.

Thanks.

Answer
$string = "THIS IS SOME TEXT";
$string=explode(" ",$string);
$i=0;
while($i<count($string)){
    $string[$i] = lcfirst($string[$i]);
    $i++;
}
echo implode(" ",$string);

Found another function at this link.

Comments