0

I found << in a php script and I want to know how it works;

eg:

echo 2 << 4;

it prints 32

CraigTeegarden
  • 8,119
  • 8
  • 36
  • 43

1 Answers1

2

Shift left

From the php.net manual on Bitwise Operators:

Shift the bits of $a $b steps to the left (each step means "multiply by two")


2 << 4 means 2 * 2^4 = 32

Ragnar123
  • 4,804
  • 4
  • 22
  • 34