Bird
0
0

What will be the output of this PHP code?

medium📝 Predict Output Q5 of 15
PHP - Output and String Handling
What will be the output of this PHP code?
echo "Hello\"World\"!";
AHello\"World\"!
BHello"World"!
CHelloWorld!
DHello"World!
Step-by-Step Solution
Solution:
  1. Step 1: Understand escaped double quotes inside string

    \" allows double quotes inside double-quoted strings without ending the string.
  2. Step 2: Output interpretation

    The output will include the double quotes around World: Hello"World"!
  3. Final Answer:

    Hello"World"! -> Option B
  4. Quick Check:

    Escaped quotes print as quotes [OK]
Quick Trick: Use \" to print double quotes inside strings [OK]
Common Mistakes:
  • Printing escape characters literally
  • Omitting escape for quotes
  • Confusing with single quotes

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes