Reference And Education Articles - Debt Consolidation - Find jobs - Sport Betting Bonuses - Debt Consolidation

PDA

View Full Version : Convert All Upper , to Lower with First Letter Upper


sparksflying
May 24th 2007, 4:58 am
Hi ,

I have some fields with data in uppercase and i know I can use php function to convert *ALL* to lower ...http://ie.php.net/strtolower

But any ideas how to keep the first letter capital and convert the rest???

Hmmmmmm

turiel
May 24th 2007, 5:06 am
You can use the ucfirst() function.

So ucfirst("blah");

Will result in "Blah".

tinkerbox
May 24th 2007, 8:14 am
$text = "hello world";
echo strtoupper($text); // HELLO WORLD
echo ucfirst($text); // Hello world
echo ucwords($text); // Hellow World

zeljic
Jun 3rd 2009, 2:29 am
Just another option:
$str = "HELLO WORLD";
echo ucfirst(strtolower($bar)); // Hello word

PoPSiCLe
Jun 3rd 2009, 6:13 am
Except that the above should be:
$str = "HELLO WORLD";
echo ucfirst(strtolower($str)); //Hello World

;)