Question

I was looking at this article about facebook's HipHop Virtual Machine (HHVM) when I noticed this line:

<?php
$u_bytes =
$p_bytes = 100 << 20;

I tested it by running echo 100 << 20; and the value was 104857600. What does << 20 do?


Edit

Based on the answers it's a bitwise operator (bit shift [left]). Example:

100       = 000000000000000000001100100
                                ^ `<< 20` moves this bit 20 bits to the left
104857600 = 110010000000000000000000000
Was it helpful?

Solution

This is a bit shift left.

You can learn more on how it works in PHP directly on PHP Manual: http://php.net/manual/en/language.operators.bitwise.php

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top