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 display newline characters on a webpage?

How do I add commas easily to a string of numbers?

How do I find the length of a string in PHP?

How do I make the contents of a string upper case?

I retrieve data from a Mysql database and insert it into a textfield form. The data that I retrieve have a / at the end of the string. The data in the database does not have this / in the data. How do I remove this /?



Custom Search