Bird
0
0

What will be the output of this PHP code?

medium📝 Predict Output Q13 of 15
PHP - Variables and Data Types
What will be the output of this PHP code?
$age = 25;
$age = $age + 5;
echo $age;
A25
BError
C5
D30
Step-by-Step Solution
Solution:
  1. Step 1: Understand variable assignment and update

    $age starts at 25, then 5 is added and stored back in $age.
  2. Step 2: Calculate the new value

    25 + 5 = 30, so $age becomes 30.
  3. Final Answer:

    30 -> Option D
  4. Quick Check:

    25 + 5 = 30 [OK]
Quick Trick: Adding to variable updates its value [OK]
Common Mistakes:
  • Expecting original value without addition
  • Confusing assignment with comparison
  • Thinking echo prints variable name

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes