comparison operators

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rehfeld
Forum Regular
Posts: 741
Joined: Mon Oct 18, 2004 8:14 pm

comparison operators

Post by rehfeld »

is there a diff between these?

Code: Select all

<?php

$var1 != $var2

$var1 <> $var2


?>
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post by neophyte »

According to this I'd say no.
rehfeld
Forum Regular
Posts: 741
Joined: Mon Oct 18, 2004 8:14 pm

Post by rehfeld »

yeah thats what led me to ask the question.
i see people use <> occasionally and was just curious if there was some diff performance, or if it was just habit from other prog langs.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

I don't think <> would work on a string, althought != does
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Well, not equal is in
(most) programming languages: !=
sql: <>


But MySQL also supports != and PHP also supports <>
Post Reply