本文介绍了3个不同的等于的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

====== 有什么区别?

What is the difference between =, ==, and ===?

我认为使用一个等号是声明一个变量,两个等号用于比较条件,最后三个等号用于比较声明变量的值.

I think using one equal sign is to declare a variable while two equal signs are for a comparison condition and lastly three equal signs are for comparing values of declared variables.

推荐答案

你有=赋值运算符==>'相等' 比较运算符=== '相同' 比较运算符.

$a = $b     Assign      Sets $a to be equal to $b.
$a == $b    Equal       TRUE if $a is equal to $b.
$a === $b   Identical   TRUE if $a is equal to $b, and they are of the same type. (introduced in PHP 4)

有关 ===== 的必要性以及使用它们的情况的更多信息,请查看 文档.

For more info on the need for == and ===, and situations to use each, look at the docs.

这篇关于3个不同的等于的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 09:29