Multiple choice php

Which of the following expressions multiply the value of the integer variable $a by 4?

  1. $a *= pow (2, 2);

  2. $a >>= 2;

  3. $a <<= 2;

  4. $a = $a $a;

Reveal answer Fill a bubble to check yourself
A,C Correct answer
Explanation

In PHP, '$a <<= 2' shifts the bits of $a two places to the left, which is equivalent to multiplying by 2 squared (4). The first option '$a *= pow(2, 2)' also results in $a * 4. Since this is a multiple-choice question with two correct options, both are valid logic.