ucwords() function will take string as input and converts first letter of every word in a string to uppercase letter, if that character is alphabetic. In general language, its name implies UC = Upper Case the words.
[table caption=”” width=”100%” colwidth=”50%|50%” colalign=”left|left”]
Version, Description
5.4.32 & 5.5.16, Added the delimiters parameter.
[/table]
This will return a changed string.
<?php $strExample = "An example of a ucwords() function."; echo ucwords($strExample); ?>
In above example ,We have a string ‘An example of a ucwords() function’. Now this function will converts every first letter in a word to Uppercase. See below is the output of above code.
<?php $strExample = "AN Example Of A ucwords() function WITH 789789."; echo ucwords($strExample); ?>
In above example ,We have a string ‘AN Example Of A ucwords() function WITH 789789.’. Now this function will converts every first letter in a word to Uppercase, it will not do anything with numeric numbers. See below is the output of above code.
If you want to apply ucwords function on the basis of some separator. Use below example :
<?php $strExample ="an example |of a ucwords() |function."; echo ucwords($strExample,"|"); ?>
Output will be like below:
App usage is growing steadily without showing any signs of slowing down. Hence, it is no surprise that mobile applications…
As the world has grown more digital, businesses have adapted themselves. An effectual adaptation includes online advertising. Offline advertising styles…
Step into a world where apps dance to the user's tune. Picture Instagram, a photo-sharing sensation that swept the globe.…
COVID-19 has led to a digitalization of lifestyle. As patients are taking their mental and physical health more seriously, healthcare…
Introduction WordPress, an immensely popular content management system (CMS), powers over 40% of the internet. What makes WordPress even more…
For moving companies trying to capture their market share amidst stiff competition, a tip or two about what they can…