7

Using the PHP manual on ucwords here I converted my PHP echo.

echo(ucwords($row['Subdivision']));

The results is still in all upper case like this:

WHISPER LAKE

Rocco The Taco
  • 3,695
  • 13
  • 46
  • 79

2 Answers2

31

You need to do this:

echo ucwords(strtolower($row['Subdivision']));

In case of all latter are in upper ucwords does no change the case. so you need to convert the string in lower case first.

You can see the example in the link which is given by you. The link is here.

You whole word is in upper case that's why is not working.

ucwords function is used to convert the first letter of each words in upper case of string. And if it is in upper case already then will remain same. It will not work for other letter of word to covert it in lower case.

Code Lღver
  • 15,573
  • 16
  • 56
  • 75
  • Well, that's silly! (I guess technically the description on [php.net](http://php.net/manual/en/function.ucwords.php) doesn't *technically* say it changes any letters besides the first of each word...but jeesh!) Thanks+ – ashleedawg Feb 20 '19 at 08:51
-1

For anyone who encounters this currently. The solution is:

echo ucfirst(strtolower($row['Subdivision']));

dom kopo
  • 1
  • 1