Bird
0
0

What is the output of this PHP code?

medium📝 Predict Output Q4 of 15
PHP - Operators
What is the output of this PHP code?
$first = "Good";
$second = "Morning";
echo $first . " " . $second;
AGoodMorning
BGood Morning
CGood.Morning
DGood+Morning
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the concatenation with space

    The code concatenates $first, a space string " ", and $second.
  2. Step 2: Combine the strings

    Result is "Good" . " " . "Morning" = "Good Morning".
  3. Final Answer:

    Good Morning -> Option B
  4. Quick Check:

    Concatenation with space = "Good Morning" [OK]
Quick Trick: Add " " between strings to insert space [OK]
Common Mistakes:
  • Forgetting space string
  • Using + instead of .
  • Expecting dot or plus in output

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes