Bird
0
0

Identify the error in the following PHP code:

medium📝 Debug Q14 of 15
PHP - Output and String Handling
Identify the error in the following PHP code:
print("Hello", "World");
ASyntax error because print cannot take multiple arguments.
BNo error; it prints HelloWorld.
CRuntime error due to missing semicolon.
DPrint returns 1 but does not output anything.
Step-by-Step Solution
Solution:
  1. Step 1: Check print argument rules

    print accepts only one argument; multiple arguments cause syntax error.
  2. Step 2: Confirm error type

    Passing multiple arguments separated by commas to print is invalid syntax.
  3. Final Answer:

    Syntax error because print cannot take multiple arguments. -> Option A
  4. Quick Check:

    Print single argument only [OK]
Quick Trick: Print accepts only one argument, else syntax error [OK]
Common Mistakes:
  • Assuming print can take multiple arguments
  • Ignoring syntax error messages
  • Confusing print with echo behavior

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes