Bird
0
0

What will be the output of the following PHP code?

medium📝 Predict Output Q4 of 15
PHP - Basics and Execution Model
What will be the output of the following PHP code?
<?php
$a = 7;
$b = 3;
echo $a * $b;
?>
A10
B21
C4
D73
Step-by-Step Solution
Solution:
  1. Step 1: Identify variables and operation

    The variables $a and $b are assigned 7 and 3 respectively.
  2. Step 2: Perform multiplication

    The echo statement outputs the product of $a and $b, which is 7 * 3 = 21.
  3. Final Answer:

    21 -> Option B
  4. Quick Check:

    Multiplication of 7 and 3 equals 21 [OK]
Quick Trick: Multiply variables directly to get output [OK]
Common Mistakes:
  • Adding instead of multiplying variables
  • Concatenating variables as strings
  • Confusing multiplication with addition

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes