-5

I've always been using != as "not equal to" in C++ and PHP. I just realized <> does the same thing. What's the difference?

Just in case if there is no difference, why does <> exist?

mamady
  • 180
  • 1
  • 11

2 Answers2

1

They are the same, just different syntax

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

Source: PHP Documentation

Sam Battat
  • 5,725
  • 1
  • 20
  • 29
0

They are the same

$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.
jrbedard
  • 3,662
  • 5
  • 30
  • 34