Home >Backend Development >PHP Tutorial >PHP XOR Operator_PHP Tutorial

PHP XOR Operator_PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 17:53:071996browse

Or operator, & exclusive operator. When writing code, I always forget to write $, which makes me think I wrote it wrong
[php]
$i=0;
$i=i|1;
echo "$i";// Explain the difference between "" double quotation marks and '' single quotation marks: double quotation marks will output the value inside, such as the value of $i, 1. If single quotation marks are used, the string $i will be output directly
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;
The output result is:
[php]
1
3

11
1
2
0
8

At this time $i&4 is less than 0

Author: Android_Xiaoqi

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478074.htmlTechArticleOr operator, exclusive operator. I always forget to write $ when writing code, so I think I wrote it wrong [php] $i=0; $i=i|1; echo $i;// Explain the difference between double quotes and single quotes: Double quotes Will output...
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