ucfirst question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

ucfirst question

Post by pleigh »

i understand that ucfirst() will make the first letter of a word to be in uppercase...what if i have a sentence "my new project"....is it possible for me to make each word to be in uppercase?
My New Project
in my case, i have a textbox that will handle sentence...and in one click, data will be stored in the database...i want to make each word to uppercase when i view it with view.php....

i already done this

Code: Select all

ucfirst($row[0])
($row[0] contains the words my new projects)

and the result in the view.php page is 'My new project'
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post by phpScott »

check out http://uk2.php.net/manual/en/function.ucwords.php in the manual
god couple of examples as well.
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

Post by pleigh »

yup thanks...it was ucwords() indeed..hehehe...missed that.
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post by phpScott »

see the trees for the forest sort of thing :D
Post Reply