markvaughn2006 Posted September 16, 2009 Share Posted September 16, 2009 I've found that most people when registering their username use all lowercase letters, is there a way that if someone were to enter their username as - markvaughn2006 it would echo something like "Welcome Markvaughn2006" ? I know how to add the Welcome and the username, just wondering if there is a way to capitalize the first letter. Thanks you guys are the best. Quote Link to comment https://forums.phpfreaks.com/topic/174484-echo-capitalize-first-letter-in-name/ Share on other sites More sharing options...
mattal999 Posted September 16, 2009 Share Posted September 16, 2009 Yep. ucwords(). It'll do exactly what you want. Quote Link to comment https://forums.phpfreaks.com/topic/174484-echo-capitalize-first-letter-in-name/#findComment-919628 Share on other sites More sharing options...
markvaughn2006 Posted September 16, 2009 Author Share Posted September 16, 2009 Quote Link to comment https://forums.phpfreaks.com/topic/174484-echo-capitalize-first-letter-in-name/#findComment-919722 Share on other sites More sharing options...
MadTechie Posted September 16, 2009 Share Posted September 16, 2009 if its ONLY the first letter you should use ucfirst() ucfirst(strtolower("MADTECHIE")); also note the Topic Solved button bottom left Quote Link to comment https://forums.phpfreaks.com/topic/174484-echo-capitalize-first-letter-in-name/#findComment-919818 Share on other sites More sharing options...
Maq Posted September 16, 2009 Share Posted September 16, 2009 Note that mattal999's suggestion will capitalize the first letter of every word in the string. i.e. $s="maq is the shiz"; echo ucwords($s); output Maq Is The Shiz Quote Link to comment https://forums.phpfreaks.com/topic/174484-echo-capitalize-first-letter-in-name/#findComment-919820 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.