Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UCWords not converting string to uppercase for each word [duplicate]

Tags:

php

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

like image 502
Rocco The Taco Avatar asked Apr 15 '14 11:04

Rocco The Taco


1 Answers

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.

like image 83
Code Lღver Avatar answered Sep 28 '22 09:09

Code Lღver