PHP Questions Home | Register | Login
Categories
Arrays
Files
Forms
Creating PDFs
PHP Errors
Functions
Images
MySQL
Numbers
Others
Strings
Website
Unanswered

PHP Forums
Forums Index
MySQL Forum
PHP Forum
Flash/Actionscript
Javascript
Web design

More PHP
PHP Functions
Top Questions
Ask a Question
PHP Interview Questions
PHP Jobs
Ecommerce
IT Questions
Business Websites

Sponsors

sponsor ad
My Salary
PHP Developer Salary
Advertise Here

How do I make the first letter of each word upper case?


This is a very useful function for titles and headings on pages, particularly if they may have been entered by the user and you want to sanitise what they entered so that your pages are nice and uniform.

It's a very simple function to use, as you can see here:

<?php
$mystring 
"i think this is a great page title";
echo 
ucwords($mystring);
?>


prints:

I Think This Is A Great Page Title



Comment on this Question and Answer >>>

ASK A QUESTION

More strings PHP Questions

How do I count the number of words in my text?

How can I repeat a string variable several times?

How do I count how many times each character occurs in a string?

How can I remove trailing space from a string?

What is the difference between join and implode in PHP?



Custom Search