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:
When it comes to children, there’s one universal truth: the right toy can spark imagination, build skills, and make memories…
In today’s digital age, where screens and gadgets dominate our children’s lives, there’s something heartwarming about a well-loved plush toy…
In a world dominated by screens and fast-paced routines, it’s easy to forget the simple magic of a toy in…
In the heart of Delhi’s vibrant streets lies a world where imagination meets innovation — the magical universe of toys.…
When was the last time a toy truly amazed you—not just as a product, but as a thoughtful tool for…
In the digital age, the way we experience childhood has changed, but the essence remains the same—imagination, exploration, and joy.…