Bird
0
0

What will be the output of this PHP code?

medium📝 Predict Output Q13 of 15
PHP - Basics and Execution Model
What will be the output of this PHP code?
<?php
echo "Hello World!";
?>
Aecho "Hello World!";
BHello World!
CSyntax Error
DNo output
Step-by-Step Solution
Solution:
  1. Step 1: Understand the echo statement

    The echo command prints the string inside quotes to the screen exactly as it is.
  2. Step 2: Check the code syntax

    The code uses correct PHP tags and syntax, so it will output the string "Hello World!".
  3. Final Answer:

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

    echo prints "Hello World!" [OK]
Quick Trick: echo prints text inside quotes directly [OK]
Common Mistakes:
  • Expecting code to print the echo statement itself
  • Missing semicolon causing syntax error
  • Not using correct PHP tags

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes