1

I do not know if this question have been asked before.

But I was wondering when I should use <> over !=

I know that if I do something like this the result will be equal but I do not know the difference between the two operators

if (1 != 0) {
    // true
}

and

if (1 <> 0) {
    // true
}

Please explain me the differences.

Szenis
  • 3,798
  • 2
  • 20
  • 33
  • The only difference is that you can add an extra '=' to '!=' ('!==') to compare both the type and value of the operands while you can't do it for '<>':D – Abdo Adel May 29 '15 at 13:30
  • 1
    @AbdoAdel haha yes i knew about that but when I was looking trough some work of another programmer I saw he was using <> and != so I thought maybe there is a difference between those two operators – Szenis May 29 '15 at 13:31

1 Answers1

4

They are exactly the same, from the manual:

$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.

Community
  • 1
  • 1
Daan
  • 11,690
  • 6
  • 30
  • 49
  • Oh really?? How useless ^^ but thanks for telling me! – Szenis May 29 '15 at 13:26
  • 1
    http://stackoverflow.com/q/4294579/ which is a duplicate of a duplicate of a duplicate – Funk Forty Niner May 29 '15 at 13:31
  • @Fred-ii- Ah yes i see it sorry for that. Thats why i said i dont know if this question has been asked before. Should I delete it? – Szenis May 29 '15 at 13:32
  • @Szenis I won't "tell" you to delete it, but the link I closed the question with, does contain a link, to a link to that link lol the choice is yours. – Funk Forty Niner May 29 '15 at 13:34
  • @Fred-ii- Ah i tried to delete it but I can't as it has answers >. – Szenis May 29 '15 at 13:35
  • @Szenis oh well. You can always try flagging your question to ask for it to be deleted. Sometimes it works, and other times people refuse it. They can be rather strange animals at times. – Funk Forty Niner May 29 '15 at 13:36