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?
print "PHP";
print " is fun!";
APHP is fun!
BPHP is fun!
C!nuf si PHP
DPHP is fun! PHP
Step-by-Step Solution
Solution:
  1. Step 1: Analyze first print statement

    print "PHP"; outputs PHP without newline.
  2. Step 2: Analyze second print statement

    print " is fun!"; outputs immediately after first, no newline.
  3. Final Answer:

    PHP is fun! -> Option A
  4. Quick Check:

    print outputs concatenated text = B [OK]
Quick Trick: print does not add newlines automatically [OK]
Common Mistakes:
  • Expecting automatic newlines
  • Confusing print with echo behavior
  • Assuming spaces are missing

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes