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?
print echo "Hello";
AHello
BHello1
C1Hello
DSyntax error
Step-by-Step Solution
Solution:
  1. Step 1: Analyze syntax of print echo

    print is a function-like construct that expects one argument; echo is a language construct and cannot be used as an argument.
  2. Step 2: Identify error

    Using print echo "Hello"; is invalid syntax and causes a parse error.
  3. Final Answer:

    Syntax error -> Option D
  4. Quick Check:

    print cannot take echo as argument [OK]
Quick Trick: print cannot take echo as argument; causes syntax error [OK]
Common Mistakes:
  • Thinking print can wrap echo
  • Assuming code outputs Hello
  • Ignoring PHP syntax rules

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes