Bird
0
0

What will be the output of the following PHP code?

medium📝 Predict Output Q13 of 15
PHP - Output and String Handling
What will be the output of the following PHP code?
print 123;
print " apples";
A123apples
B123" apples"
C123 apples
DError: missing semicolon
Step-by-Step Solution
Solution:
  1. Step 1: Analyze first print statement

    print 123; prints the number 123 without quotes.
  2. Step 2: Analyze second print statement

    print " apples"; prints the text ' apples' with a space before apples.
  3. Step 3: Combine outputs

    Both prints run one after another, so output is '123 apples'.
  4. Final Answer:

    123 apples -> Option C
  5. Quick Check:

    Number + text prints together = 123 apples [OK]
Quick Trick: Print numbers without quotes, text with quotes, outputs join [OK]
Common Mistakes:
  • Expecting quotes to print literally
  • Missing space between number and text
  • Thinking missing semicolon causes error here

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes