0

I just saw this "<>" in someones source code and honestly I've never seen someone use that to replace "!="

Example:

if($a <> $b)

vs

if($a != $b)

Are there advantages or disadvantages to using <> ? They are doing it to compare an array... Still not sure if that means anything.

Cheers!

Brady Liles
  • 705
  • 7
  • 13
  • I guess they mean the same but in different languages. AFAIK, Delphi uses `<>` instead of `!=` as seen in many C-like languages. – Jeff Jun 18 '14 at 05:12
  • 3
    What language? Some languages (Delphi and VB) use `<>` exclusively for `!=`. C-derived languages use `!=` exclusively. Some of those crazy new-fandangled script languages might offer both (the horror!). – Cody Gray Jun 18 '14 at 05:12
  • This is in a PHP project, I guess it could just be his habit.. But I see "!=" in other conditionals... – Brady Liles Jun 18 '14 at 05:13
  • I guess it could just be a multi-user project.. o.O – Brady Liles Jun 18 '14 at 05:14
  • Is your question general, or more php-specific? `<>` is [deprecated](https://docs.python.org/release/2.5.2/lib/comparisons.html) in Python, so you'd want to use `!=` in that case. – morric Jun 18 '14 at 05:17
  • http://www.php.net/manual/en/language.operators.php – Sverri M. Olsen Jun 18 '14 at 05:19
  • The PHP manual says both != and <> have the same result of: if $a is not equal to $b after type juggling. [source](http://www.php.net//manual/en/language.operators.comparison.php) But I appreciate knowing the difference in other languages too. – Brady Liles Jun 18 '14 at 05:22
  • http://stackoverflow.com/questions/9671785/what-is-the-difference-between-and Found this duplicate.. Oops. :P – Brady Liles Jun 18 '14 at 05:23

0 Answers0