Bird
0
0

Which of the following is the correct syntax to print the number 10 using echo in PHP?

easy📝 Syntax Q3 of 15
PHP - Output and String Handling
Which of the following is the correct syntax to print the number 10 using echo in PHP?
Aecho 10;
BAll of the above
Cecho (10);
Decho "10";
Step-by-Step Solution
Solution:
  1. Step 1: Understand echo syntax for numbers

    Echo can print numbers directly without quotes or with quotes as strings.
  2. Step 2: Check each option

    echo 10; prints number 10 directly. echo "10"; prints string "10" which looks the same. echo (10); uses parentheses which are allowed. All are valid.
  3. Final Answer:

    All of the above -> Option B
  4. Quick Check:

    Echo accepts numbers with or without quotes [OK]
Quick Trick: Echo prints numbers with or without quotes [OK]
Common Mistakes:
  • Thinking parentheses are not allowed
  • Confusing strings and numbers in echo
  • Using semicolon incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes