Home > Backend Development > PHP Problem > What is the difference between php <> and !=?

What is the difference between php <> and !=?

青灯夜游
Release: 2023-02-28 20:02:02
Original
7386 people have browsed it

php What is the difference between <> and !=? The following article will introduce it to you. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

What is the difference between php <> and !=?

##The difference between php <> and !=

<> and != are all judged to be unequal.

In the early days, PHP used

<>, and later upgraded to !=. There is basically no difference between the two, it depends on personal coding habits.

<> has the same effect as !=, there is no difference; however, it is recommended to use !=, which is more readable high.

But it’s just the opposite in mysql. != is the early SQL standard, <> is the current SQL standard, and it is recommended to use <>.

Extension:

PHP comparison operator

PHP comparison operator is used to compare two values ​​(numbers or strings):

OperatorNameExampleResult==Equals$x == $yReturns true if $x is equal to $y. ===Congruent (identical) $x === $yIf $x is equal to $y, and they are of the same type, return true. ##<> is not equal to $x <> $yReturns true if $x is not equal to $y. !==><>=<=For more related knowledge, please pay attention to
!= is not equal to $x != $y Returns true if $x is not equal to $y.
Not congruent (completely different) $x !== $y if Returns true if $x is not equal to $y, or they are not of the same type.
is greater than $x > $y Returns true if $x is greater than $y.
is less than$x < $yReturns true if $x is less than $y.
Greater than or equal to $x >= $y If $x is greater than or equal to $ y, then return true.
is less than or equal to $x <= $y if Returns true if $x is less than or equal to $y.
PHP Chinese website

! !

The above is the detailed content of What is the difference between php <> and !=?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template