Orionsbelter Posted February 1, 2010 Share Posted February 1, 2010 Is there a function to capitalize a variable? such as; <?php $username= capitalize($_POST['username']); ?> I do understand that i can capitalize the word in CSS however i need this to be capitalize before it goes into the database and not capitalize the string form the database. Thanks for all your help Quote Link to comment https://forums.phpfreaks.com/topic/190490-php-function-to-capitalize-vars/ Share on other sites More sharing options...
aebstract Posted February 1, 2010 Share Posted February 1, 2010 $str = strtoupper($str); Quote Link to comment https://forums.phpfreaks.com/topic/190490-php-function-to-capitalize-vars/#findComment-1004785 Share on other sites More sharing options...
Orionsbelter Posted February 1, 2010 Author Share Posted February 1, 2010 Wont that make all the charters uppercase? such as TESTER CODE It stead of Tester Code Quote Link to comment https://forums.phpfreaks.com/topic/190490-php-function-to-capitalize-vars/#findComment-1004793 Share on other sites More sharing options...
KevinM1 Posted February 1, 2010 Share Posted February 1, 2010 Wont that make all the charters uppercase? such as TESTER CODE It stead of Tester Code Try ucfirst or ucwords, depending on what your needs are. And, like always, when in doubt, consult the manual: http://www.php.net/quickref.php Quote Link to comment https://forums.phpfreaks.com/topic/190490-php-function-to-capitalize-vars/#findComment-1004795 Share on other sites More sharing options...
Orionsbelter Posted February 1, 2010 Author Share Posted February 1, 2010 Lol, i've just found that cheers Quote Link to comment https://forums.phpfreaks.com/topic/190490-php-function-to-capitalize-vars/#findComment-1004797 Share on other sites More sharing options...
aebstract Posted February 1, 2010 Share Posted February 1, 2010 Thought you wanted it all capital, you didn't really clarify too well. Oh well. Quote Link to comment https://forums.phpfreaks.com/topic/190490-php-function-to-capitalize-vars/#findComment-1004799 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.