rwwd Posted March 22, 2006 Share Posted March 22, 2006 [!--fonto:Verdana--][span style=\"font-family:Verdana\"][!--/fonto--] Hello there everybody,Silly thing to ask but say you have a string ie: timothy, and you wanted this to become first letter uppercase ie: Timothy, how would I do this, so that every time you have a string in a variable the first letter displayed would be uppercase every time?Any help is appreciatedThanks Rwwd[!--fontc--][/span][!--/fontc--] Link to comment https://forums.phpfreaks.com/topic/5500-string-conversion/ Share on other sites More sharing options...
kenrbnsn Posted March 22, 2006 Share Posted March 22, 2006 There is the function [a href=\"http://www.php.net/ucwords\" target=\"_blank\"]ucwords[/a]() which will make each word in a string start with a capital letter. Is this what you are looking for?You can also use CSS.[code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head> <title></title> <style>.initc { text-transform: capitalize;} </style></head><body><p class="initc">this is a test</p><p><?php echo ucwords('this is another test') ?></p></body></html>[/code]Ken Link to comment https://forums.phpfreaks.com/topic/5500-string-conversion/#findComment-19668 Share on other sites More sharing options...
rwwd Posted March 27, 2006 Author Share Posted March 27, 2006 Hi there Ken,Thanks for the help, I didnt realise as you could do this in css aswell as php, in the end i settled for the ucfirst(), which served the purpose perfectly, but you have given me an idea for my next project.Again thanks for the helpRWWD. Link to comment https://forums.phpfreaks.com/topic/5500-string-conversion/#findComment-21329 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.