php中两个不相等的运算符有什么区别?

时间:2017-09-16 03:34:20

标签: php

有两个不相等的运算符!=<>。它们是一样的吗?或者它们彼此略有不同?

2 个答案:

答案 0 :(得分:1)

他们是平等的:http://php.net/manual/en/language.operators.comparison.php

$a != $b    // Not equal    TRUE if $a is not equal to $b after type juggling.
$a <> $b    // Not equal    TRUE if $a is not equal to $b after type juggling.
$a !== $b // Not identical  TRUE if $a is not equal to $b, or they are not of the same type.

答案 1 :(得分:1)

没有区别。您可以在MSSQL中使用它们。

The MSSQL doc says:

  

!=的功能与<>(不等于)比较相同   操作

<>中定义了!=<>.未定义NFiniteAutomaton。因此,并非所有数据库引擎都支持它,如果您想生成可移植代码,我建议使用NFiniteAutomaton