Bird
0
0

Which PHP function capitalizes the first character of each word in a string?

easy📝 Conceptual Q1 of 15
PHP - String Functions
Which PHP function capitalizes the first character of each word in a string?
Aucwords()
Bucfirst()
Cstrtoupper()
Dstrtolower()
Step-by-Step Solution
Solution:
  1. Step 1: Understand the function purpose

    The function ucwords() capitalizes the first letter of each word in a string.
  2. Step 2: Compare with other functions

    ucfirst() capitalizes only the first letter of the entire string, strtoupper() converts all letters to uppercase, strtolower() converts all letters to lowercase.
  3. Final Answer:

    ucwords() -> Option A
  4. Quick Check:

    Capitalizing first letter of each word = ucwords() [OK]
Quick Trick: Use ucwords() to capitalize each word's first letter [OK]
Common Mistakes:
  • Confusing ucfirst() with ucwords()
  • Using strtoupper() instead
  • Expecting strtolower() to capitalize

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes