What does << mean in php

WBOY
Release: 2023-03-14 15:22:01
Original
3762 people have browsed it

"

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";  
?>
Copy after login

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!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!