EchoFool Posted May 19, 2009 Share Posted May 19, 2009 Hi there, Just a quick question i been using ucfirst(); but have realised it only capatalises the first letter of the string, but this is flawed for me because the string may have more than one word such as: Joe bloggs < this is what it would show... but i need it to capatalise the first letter of every word because its a name so it would be Joe Bloggs. How do i do it because ucfirst(); doesn't do it Link to comment https://forums.phpfreaks.com/topic/158677-solved-upper-case-more-than-one-word/ Share on other sites More sharing options...
JREAM Posted May 19, 2009 Share Posted May 19, 2009 try ucwords(); alternatively you could do this in css with: .element {text-transform: capitalize;} Link to comment https://forums.phpfreaks.com/topic/158677-solved-upper-case-more-than-one-word/#findComment-836880 Share on other sites More sharing options...
MadTechie Posted May 19, 2009 Share Posted May 19, 2009 you need to use ucwords() ie ucwords(strtolower("joe bloggs")); convert to lower first or JOE BLOGGES will fail Link to comment https://forums.phpfreaks.com/topic/158677-solved-upper-case-more-than-one-word/#findComment-836882 Share on other sites More sharing options...
EchoFool Posted May 19, 2009 Author Share Posted May 19, 2009 Thanks guys! Link to comment https://forums.phpfreaks.com/topic/158677-solved-upper-case-more-than-one-word/#findComment-836886 Share on other sites More sharing options...
MadTechie Posted May 19, 2009 Share Posted May 19, 2009 alternatively you could do this in css with: .element {text-transform: capitalize;} Nice idea.. I didn't think of that, Link to comment https://forums.phpfreaks.com/topic/158677-solved-upper-case-more-than-one-word/#findComment-836888 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.