Skip to content

Latest commit

 

History

History
23 lines (18 loc) · 647 Bytes

0319.md

File metadata and controls

23 lines (18 loc) · 647 Bytes

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