Recall & Review
beginner
What does the PHP function
strtolower() do?It converts all characters in a string to lowercase letters.
Click to reveal answer
beginner
What is the purpose of the PHP function
strtoupper()?It converts all characters in a string to uppercase letters.
Click to reveal answer
beginner
How does
ucfirst() function modify a string in PHP?It converts the first character of the string to uppercase and leaves the rest unchanged.
Click to reveal answer
beginner
What does the PHP function
ucwords() do?It converts the first character of each word in a string to uppercase.
Click to reveal answer
intermediate
Which PHP function would you use to convert a string to lowercase except the first letter of each word?
Use
ucwords(strtolower($string)) to first convert the whole string to lowercase, then capitalize the first letter of each word.Click to reveal answer
Which PHP function converts all letters in a string to uppercase?
✗ Incorrect
strtoupper() changes all characters in a string to uppercase.
What does the
ucfirst() function do in PHP?✗ Incorrect
ucfirst() only changes the first character of the string to uppercase.
If you want to capitalize the first letter of each word in a string, which function should you use?
✗ Incorrect
ucwords() capitalizes the first letter of each word in the string.
What will
strtolower('HELLO World') return?✗ Incorrect
strtolower() converts all letters to lowercase.
Which combination of functions converts a string to lowercase and then capitalizes the first letter of each word?
✗ Incorrect
First strtolower() makes all letters lowercase, then ucwords() capitalizes the first letter of each word.
Explain how to convert a string to all uppercase and all lowercase in PHP.
Think about functions that change the whole string's letter case.
You got /3 concepts.
Describe how to capitalize only the first letter of a string and how to capitalize the first letter of each word in PHP.
One works on the whole string's first letter, the other on each word.
You got /3 concepts.