<<< Previous question <<< Question ID#0319.md >>> Next question >>>
The bitwise left shift (>) operands move the bits in the left operand left or right by the number of positions in the right operand. This is in effect a fast way to multiple or divide by powers of 2. What is the output of the following script?
$a = 15 << 2;
$b = 10 >> 1;
$c = 0xF0 >> 4;
echo sprintf('%d - %d - 0x%X', $a, $b, $c);
- A) 60 - 5 - 0xF
- B) 30 - 5 - 0x0
- C) 30 - 10 - 0xF
- D) 60 - 10 - 0xF
Answer
Answer: A