Home >Backend Development >PHP Tutorial >PHP XOR Operator_PHP Tutorial
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