Android programmers learn PHP development (9)-assignment comparison logical operations-PhpStorm

黄舟
Release: 2023-03-06 09:54:02
Original
1227 people have browsed it

Assignment operator symbols: =, +=, -=, *=, /=, %=, .=
Comparison operator symbols: >, <, ==, >=, < ;=, ===, !=, !==
Logical operators and or &&, or or ||, not or!, xor
xor Different is true, the same is false
die() Output a message and exit the current script


"; echo $name2."
"; $a += 1; // 等同于 $a = $a + 1; 打印结果:6 echo $a."
"; $a -= 1; // 等同于 $a = $a - 1; 打印结果:5 echo $a."
"; /**---------------分割线---------------*/ $str = "王航"; $str2 = "安卓"; echo $str.$str2."
"; // 打印结果:王航安卓 //echo $str.$str2.5."
"; // 不可以直接连接5 echo $str.$str2.$a."
"; // 但是可以连接$a($a的值为5),打印结果:王航安卓5 echo "王航安卓{$a}
"; // 打印结果:王航安卓5 echo "王航安卓".$a."
"; // 打印结果:王航安卓5 echo '王航安卓'.$a.'
'; // 打印结果:王航安卓5 echo '王航安卓{$a}
'; // 打印结果:王航安卓{$a} echo "王航安卓",$a,"
"; // 打印结果:王航安卓5 $str .= "是"; // 打印结果:王航是 echo $str."
"; $str .= "安卓程序员"; // 打印结果:王航是安卓程序员 echo $str."
"; /**---------------分割线---------------*/ $html = ''; $html .= ''; $html .= "

CSDN

"; $html .= ''; $html .= ''; echo $html."
"; // 打印结果:CSDN (一级标题) /** * 比较运算符号:>,<,==,>=,<=,===,!=,!== */ $a = "007"; $b = 7; var_dump($a===$b); // 打印结果:bool(false) , 全等于判断(变量类型也需要相同) echo "
"; var_dump($a==$b); // 打印结果:bool(true) , 等于判断 echo "
"; var_dump($a=$b); // 打印结果:int(7) , 赋值运算 echo "
"; /** * 逻辑运算符 and或者&&、or或||、not或!、xor * xor 不同为真,相同为假 */ var_dump(true && true); // 打印结果:bool(true) echo "
"; var_dump(true && false); // 打印结果:bool(false) echo "
"; var_dump(true || false); // 打印结果:bool(true) echo "
"; var_dump(!true); // 打印结果:bool(false) echo "
"; var_dump(!false); // 打印结果:bool(true) echo "
"; var_dump(true xor false); // 打印结果:bool(true) echo "
"; var_dump(false xor true); // 打印结果:bool(true) echo "
"; var_dump(true xor true); // 打印结果:bool(false) echo "
"; var_dump(false xor false); // 打印结果:bool(false) echo "
"; /**---------------分割线---------------*/ $year = 2016; if ($year%4==0 && $year%100!==0 || $year%400!==0 ){ echo "这个年{$year}是闰年
"; // 打印结果:这个年2016是闰年 }else { echo "这个年{$year}是平年
"; } /**---------------分割线---------------*/ //die("输入并退出程序!"); // 打印结果:输入并退出程序! //echo "666666"; // 这一行不会输出 /**---------------分割线---------------*/ //$link = mysql_connect("localhost","root","") or die("数据库连接失败!"); /**---------------分割线---------------*/ $a = 0; $b = 0; if ($a=3 && $b=3){ $a++; $b++; } echo $a.",".$b."
"; // 打印结果:1,4 /**---------------分割线---------------*/ $a = 0; $b = 0; if ($a=3 || $b=3){ $a++; $b++; } echo $a.",".$b."
"; // 打印结果:1,1 /**---------------分割线---------------*/ $a = 0; $b = 0; if ($a==3 || $b==3){ $a++; $b++; } echo $a.",".$b."
"; // 打印结果:0,0
Copy after login

The above is the content of Android programmers learning PHP development (9)-Assignment comparison logical operation-PhpStorm. For more related content, please Follow the PHP Chinese website (m.sbmmt.com)!



Related labels:
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
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!