I am trying to capitalize only the first word in a string. I am using
<? print ucfirst("HELLO PEOPLE"); ?>
But it is not working...
strtolower is working fine.
Any ideas why ucfirst would be working? Is this something server side?
I am trying to capitalize only the first word in a string. I am using
<? print ucfirst("HELLO PEOPLE"); ?>
But it is not working...
strtolower is working fine.
Any ideas why ucfirst would be working? Is this something server side?
I just changed my HELLO PEOPLE to hello people and it worked. My question now is how to you deal with data that starts off as all caps and you only want the first letter caps?
Actually, it is working as expected. The manual does not say it first lowercases everything, how does PHP know you want to do that? Here's the example from the manual:
$foo = 'hello world!';
$foo = ucfirst($foo); // Hello world!
$bar = 'HELLO WORLD!';
$bar = ucfirst($bar); // HELLO WORLD!
$bar = ucfirst(strtolower($bar)); // Hello world!
first of all, why is your posting so messy, u have the same question posted twice below and rather than continuing on the same thread u post another one and secondly if u read the manual u will find a function called ucwords and the example there will tell you what u need
http://ca3.php.net/manual/en/function.ucwords.php
please mark the earlier threads resolved or delete them, thanks
reg
kevin
Weird, I only posted once.....
ok, but could u mark threads resolved once they answer your questions.
there is a link below , thanks
reg
kevin