Bird
0
0

Which compound assignment operator multiplies a variable by a value and updates it?

easy📝 Conceptual Q2 of 15
PHP - Operators
Which compound assignment operator multiplies a variable by a value and updates it?
A$x /= 5;
B$x *= 5;
C$x += 5;
D$x -= 5;
Step-by-Step Solution
Solution:
  1. Step 1: Identify multiplication compound operator

    The operator *= multiplies the variable by the right value and updates it.
  2. Step 2: Compare with other operators

    /= divides, += adds, and -= subtracts, so they are incorrect for multiplication.
  3. Final Answer:

    $x *= 5; -> Option B
  4. Quick Check:

    Multiplication compound operator = *= [OK]
Quick Trick: Use *= to multiply and assign in one step [OK]
Common Mistakes:
  • Using /= instead of *= for multiplication
  • Confusing += with *= operator
  • Forgetting to update variable with compound operator

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes