Capitalizing The First Letter In Each Word | PHP

PHP's ucwords function can be used to create readable blog post titles by capitalizing the first characters of each word.

Additionally, you can capitalize the first character of names in your app.

Below is an example of how to use the ucwords function.

Example


01: <?php
02: 
03: $text = 'here is some text';
04: $formattedString = ucwords($text);
05: 
06: echo $formattedString; //Here Is Some Text
07: 

Here is another article for you 😊 "Adding a copy button to HighlightJS Code Snippets"