Home > Article > Backend Development > What does << mean in php
"
The operating environment of this tutorial: Windows 10 system, PHP version 7.1, DELL G3 computer.
What does
Bitwise operators refer to operations on binary bits aligned from low to high.
The two less-than signs "> means moving to the right. This We can understand bit operations more easily through an example:
<?php //定义权限 define('READ', 1<< 0); // 把可读权限放在最右边 define('WRITE', 1<<1); // 可读权限向左移一位 define('EXCUTE', 1<<2); // 可执行权限向左移两位 //赋予权限 $user_permission = READ | WRITE; //验证权限 echo '可读:', ($user_permission & READ) ? 'Yes' : 'No', "\n"; echo '可写:', ($user_permission & WRITE) ? 'Yes' : 'No', "\n"; echo '可执行:', ($user_permission & EXCUTE) ? 'Yes' : 'No', "\n"; ?>
Output result:
If you are interested, you can click " PHP Video Tutorial》Learn more about PHP knowledge.
The above is the detailed content of What does << mean in php. For more information, please follow other related articles on the PHP Chinese website!