2
votes

What does the <> operator mean exactly?

Is it the same as != (not equal)?

Sample code

$foo = 'text';

if ($foo <> 'photo') {
    echo 'foo';
}
else {
    echo 'bar';
}
3
You asked the same thing 4 months ago???Mike B
Redefines the meaning of "exact duplicate" when the other question is also asked by the same person.Kzqai

3 Answers

13
votes

As NikiC notes, <> and != are the same and have the same precedence. My earlier answer was based on what appears to be a bug in the documentation which has now been corrected.

3
votes

That would be correct. It's pretty universal between languages. I usually use that method in my SQL Server queries/stored procedures.

PHP: Comparison Operators

1
votes

Yes, it's the same as != (see the manual).