什么`<<`在PHP中声明变量时的意思?

时间:2013-02-22 16:52:47

标签: php hiphop

当我注意到这一行时,我正在查看有关facebook的HipHop虚拟机(HHVM)的this article

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

我通过运行echo 100 << 20;对其进行了测试,其值为104857600. << 20做了什么?


修改

根据答案,它是一个按位运算符(位移[左])。例如:

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

1 个答案:

答案 0 :(得分:3)

这是bit shift left

您可以直接在PHP上了解有关PHP如何工作的更多信息:http://php.net/manual/en/language.operators.bitwise.php

相关问题