Bird
0
0

What will be the output of the following PHP code?

medium📝 Predict Output Q4 of 15
PHP - Output and String Handling
What will be the output of the following PHP code?
echo print("Test");
A1
B1Test
CTest
DTest1
Step-by-Step Solution
Solution:
  1. Step 1: Evaluate inner print("Test")

    print("Test") outputs "Test" and returns 1.
  2. Step 2: Evaluate outer echo with return value

    echo outputs the return value 1 from print.
  3. Final Answer:

    Test1 -> Option D
  4. Quick Check:

    print outputs string, echo outputs print's return [OK]
Quick Trick: print outputs string and returns 1, echo prints that 1 [OK]
Common Mistakes:
  • Assuming echo prints only the string
  • Thinking print returns the string instead of 1
  • Confusing output order

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes