PHP: What does << mean?

In PHP and other C-like languages, the << and >> operators are used to "shift" the bits in a value to the left and to the right, respectively.

So, $x << $y would shift the bits in $x to the left a number of times equal to the value of $y.

In binary arithmetic, a left shift of n places is the same as multiplying by 2^n, while a right shift is the same as dividing by 2^n. This can be faster than using the multiplication operator in some languages.
 
Back
Top