Home >Backend Development >PHP Tutorial >4——PHP comparison && copy operator phpstorm php download how to copy
*/ * Copyright (c) 2016,烟台大学计算机与控制工程学院 * All rights reserved. * 文件名:text.cpp * 作者:常轩 * 微信公众号:Worldhello * 完成日期:2016年5月19日 * 版本号:V1.0 * 问题描述:PHP比较运算符 * 程序输入:无 * 程序输出:见运行结果 */ <?php $a = 1; $b = "1"; var_dump($a==$b); echo "<br />"; var_dump($a===$b); echo "<br />"; var_dump($a!=$b); echo "<br />"; var_dump($a<>$b); echo "<br />"; var_dump($a!==$b); echo "<br />"; var_dump($a<$b); echo "<br />"; $c = 5; var_dump($a<$c); echo "<br />"; var_dump($a>$c); echo "<br />"; var_dump($a<=$c); echo "<br />"; var_dump($a>=$c); echo "<br />"; var_dump($a>=$b); echo "<br />"; ?>
Running results:
bool(true) bool(false) bool(false) bool(false) bool(true) bool(false) bool(true) bool(false) bool(true) bool(false) bool(true)
Appendix:
*/ * Copyright (c) 2016,烟台大学计算机与控制工程学院 * All rights reserved. * 文件名:text.cpp * 作者:常轩 * 微信公众号:Worldhello * 完成日期:2016年5月19日 * 版本号:V1.0 * 问题描述:PHP比较运算符 * 程序输入:无 * 程序输出:见运行结果 */ //赋值运算符 <?php $a = "我在学习PHP!"; $b=$a; $a = "我天天在学习PHP!"; $c=&$a; echo $b."<br />"; echo $c."<br />"; ?>
Running results:
我在学习PHP! 我天天在学习PHP!
Note:
(1) "=": Assign the value of the expression on the right to the operation on the left number. It copies the value of the expression on the right and gives it to the operand on the left. In other words, first allocate a memory for the operand on the left, and then put the copied value into this memory.
(2) "&": reference assignment, which means that both variables point to the same data. It will cause two variables to share a piece of memory. If the data stored in this memory changes, the values of both variables will change.
The above has introduced 4 - PHP comparison && copy operator, including PHP and copy content. I hope it will be helpful to friends who are interested in PHP tutorials.