{"id":512,"date":"2020-05-05T14:57:06","date_gmt":"2020-05-05T13:57:06","guid":{"rendered":"https:\/\/bastienmalahieude.fr\/?p=512"},"modified":"2020-05-05T17:37:26","modified_gmt":"2020-05-05T16:37:26","slug":"php-premiere-lettre-des-mots-en-majuscule","status":"publish","type":"post","link":"https:\/\/bastienmalahieude.fr\/en\/php-premiere-lettre-des-mots-en-majuscule\/","title":{"rendered":"Capitalize the first letter of every word in PHP"},"content":{"rendered":"

in this post, we will see how to capitalize every first letter of a sentence, or a name. This post if the 3rd of my serie on PHP useful functions. You can find my other posts about Importing a CSV file in PHP<\/a> and Export a PHP array in a CSV File<\/a>.<\/p>\n

This function is used to transform a string such as Jean-MARIE De la rue<\/strong> into Jean-Marie De La Rue<\/strong><\/p>\n

For this, we will create a custom fonction\u00a0uc_first<\/em> that takes the name of the user as a parameter and output a formatted string. This functions takes two parameters, but only the first one is required :<\/p>\n