It’s common that you need to reformat the texts in PHP and make them look a little more formal. For example, the first letter of all sentences should be uppercased, or with a title, the first letter of all words should also be made uppercase; in other situations, you may want all letters to be in uppercase.
Make all letters in a string lowercase
strtolower('ABc De!'); // returns 'abc de!'
Make all letters in a string uppercase
strtoupper('ABc De!'); // returns 'ABC DE!'
Make the first letter of every word uppercase
ucwords('world digital library'); // returns 'World Digital Library'
Make the first letter of a sentence uppercase
ucfirst('how are you?'); // returns 'How are you?'
You should also read:
- PHP: Check if A String Contain Only Uppercase / Capital Letters
- PHP Class: Convert Plural to Singular or Vice Versa in English
- PHP: Create an Array of A Range of Characters (Numbers or Letters) or Multiple Identical Values
- PHP: Return and Get the Last Letter / Character of a String
- PHP: Count Words in a String


Facebook
Twitter
Google Plus