|
-
Aug 3rd, 2007, 06:05 PM
#1
Thread Starter
New Member
[RESOLVED] capitalize Letters?
PHP Code:
$words="a sentence";
echo $words;
How would I make the start of every new word a capital letter?
edit: found out, cant make post resolved.
Last edited by rscape; Aug 3rd, 2007 at 10:26 PM.
-
Aug 4th, 2007, 08:14 AM
#2
Hyperactive Member
Re: [RESOLVED] capitalize Letters?
It does help to post the resolution so that other people with your problem/question can have the knowledge to fix it also.
PHP Code:
$words = strtoupper("a sentence");
echo $words;
» Twitter: @rudi_visser : Website: www.rudiv.se «
If Apple fixes security flaws, they are heralded as proactive. If Microsoft fixes a security flaw, they finally got around to fixing their buggy OS.
-
Aug 4th, 2007, 08:28 AM
#3
Re: [RESOLVED] capitalize Letters?
Rudi, that will convert the whole string to uppercase. To capitalise the first character of every word, use ucwords().
rscape, Sorry, I forgot to mention this at the time, but I marked your thread as resolved for you. You should be able to do this in future from the Thread Tools menu. Let me know if you cannot.
-
Aug 4th, 2007, 08:35 AM
#4
Hyperactive Member
Re: [RESOLVED] capitalize Letters?
Doh, I misread the question, sorry about that!
If you're doing this on a sentence, capitalising the first letter of every word will not make it look 'correct', if that is what you're meaning to do. If it is, take a look into regular expression replaces.
» Twitter: @rudi_visser : Website: www.rudiv.se «
If Apple fixes security flaws, they are heralded as proactive. If Microsoft fixes a security flaw, they finally got around to fixing their buggy OS.
-
Aug 4th, 2007, 08:41 AM
#5
Re: [RESOLVED] capitalize Letters?
There are some user-created examples of functions for sentence casing on the strings page of the PHP.net manual.
http://php.net/manual/en/ref.strings
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|