Home > php教程 > php手册 > PHP异或运算符

PHP异或运算符

WBOY
Release: 2016-06-13 10:51:08
Original
2048 people have browsed it

或运算符,&异运算符。写代码时总是忘了写$,搞的自己以为写错了
[php] 
$i=0; 
    $i=i|1; 
    echo "$i";// 说明一下""双引号与''单引号的区别:双引号会输出里面的值比如$i的值1,如果用单引号会直接输出字符串$i 
    echo "
"; 
    echo $i|=2; 
    echo "
"; 
    //echo $i|=4; 
    echo "
"; 
    echo $i|=8; 
    echo "
"; 
    echo $i&1; 
    echo "
"; 
    echo $i&2; 
    echo "
"; 
    echo $i&4; 
    echo "
"; 
    echo $i&8; 
输出结果为:
[php] 


 
11 



此时$i&4为小于0的

 

作者:Android_Xiaoqi

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template