ted_chou12 Posted December 15, 2006 Share Posted December 15, 2006 for example: the original string is "test"what i want it to turn to is "Test"is there any easy way to do this?Thankyou Link to comment https://forums.phpfreaks.com/topic/30773-solved-capitalizing-first-word-of-a-string/ Share on other sites More sharing options...
taith Posted December 15, 2006 Share Posted December 15, 2006 [code]$string='text text text text<br>';echo ucfirst($string);echo ucwords($string);[/code] Link to comment https://forums.phpfreaks.com/topic/30773-solved-capitalizing-first-word-of-a-string/#findComment-141838 Share on other sites More sharing options...
ted_chou12 Posted December 15, 2006 Author Share Posted December 15, 2006 many thanks Link to comment https://forums.phpfreaks.com/topic/30773-solved-capitalizing-first-word-of-a-string/#findComment-141840 Share on other sites More sharing options...
ober Posted December 15, 2006 Share Posted December 15, 2006 There is a new feature at phpfreaks. Below the last thread on the left, you'll find a "topic solved" link. Please use it! Link to comment https://forums.phpfreaks.com/topic/30773-solved-capitalizing-first-word-of-a-string/#findComment-141841 Share on other sites More sharing options...
ted_chou12 Posted December 15, 2006 Author Share Posted December 15, 2006 last thread on the left?I cant seem to find it. Link to comment https://forums.phpfreaks.com/topic/30773-solved-capitalizing-first-word-of-a-string/#findComment-141848 Share on other sites More sharing options...
ted_chou12 Posted December 15, 2006 Author Share Posted December 15, 2006 what if my string is: directory($_SERVER['PHP_SELF'])do I have to set anything or put quotation marks? because it doesn't seem to work like this:$string = echo "directory($_SERVER['PHP_SELF'])"; Link to comment https://forums.phpfreaks.com/topic/30773-solved-capitalizing-first-word-of-a-string/#findComment-141865 Share on other sites More sharing options...
taith Posted December 15, 2006 Share Posted December 15, 2006 aah... no...[code]$string = directory($_SERVER['PHP_SELF']);echo ucfirst($string); #or the likes[/code] Link to comment https://forums.phpfreaks.com/topic/30773-solved-capitalizing-first-word-of-a-string/#findComment-141870 Share on other sites More sharing options...
Recommended Posts