In this tutorial, we introduce a code snippet. Its function is to make all words start with a capital letter in a sentence. If there is any non-first capital letter, it will convert them to lowercase.
Make all words start with a capital letter in a sentence.
<?php
ucwords(strtolower($string));
?>
This snippet is a combination of two PHP native functions:
Hopefully this simple tip helped you with your development. If you like our post, please follow us on Twitter and help spread the word. We need your support to continue. If you have questions or find our mistakes in above tutorial, do leave a comment below to let us know