Home >Backend Development >PHP Problem >What does << mean in php

What does << mean in php

WBOY
WBOYOriginal
2021-12-22 15:56:303794browse

"

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(&#39;READ&#39;, 1<< 0);    // 把可读权限放在最右边  
define(&#39;WRITE&#39;, 1<<1);    // 可读权限向左移一位  
define(&#39;EXCUTE&#39;, 1<<2);   // 可执行权限向左移两位  
   
//赋予权限  
$user_permission = READ | WRITE;  
   
//验证权限  
echo &#39;可读:&#39;, ($user_permission & READ) ? &#39;Yes&#39; : &#39;No&#39;, "\n";  
echo &#39;可写:&#39;, ($user_permission & WRITE) ? &#39;Yes&#39; : &#39;No&#39;, "\n";  
echo &#39;可执行:&#39;, ($user_permission & EXCUTE) ? &#39;Yes&#39; : &#39;No&#39;, "\n";  
?>

Output result:

What does << mean in php

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn