0
0
PHPprogramming~5 mins

Case conversion functions in PHP - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
Aucfirst()
Bstrtolower()
Cstrtoupper()
Ducwords()
What does the ucfirst() function do in PHP?
AConverts the entire string to uppercase
BConverts the entire string to lowercase
CConverts the first character of each word to uppercase
DConverts 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?
Astrtoupper()
Bucwords()
Cstrtolower()
Ducfirst()
What will strtolower('HELLO World') return?
A'hello world'
B'Hello World'
C'HELLO World'
D'HELLO world'
Which combination of functions converts a string to lowercase and then capitalizes the first letter of each word?
Aucwords(strtolower($string))
Bucfirst(strtolower($string))
Cucwords(strtoupper($string))
Dstrtoupper(ucwords($string))
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.