Forum Moderators: coopster

Message Too Old, No Replies

equals not to

how not to equal

         

Twisted Mind

10:29 am on Oct 13, 2005 (gmt 0)

10+ Year Member



you know you can use the = sign to check if variables are the same (if (var1 = var2)) etc.

but i would like to know how to check if they are NOT the same how do i do that?

Thanks for you help i love you guys

HarryM

10:42 am on Oct 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I always use "if(var1 == var2)" for if it does, or "if (var1!= var2)" for if it doesn't.

I think you can probably also write "if!(var1 == var2)"

Note the exclamation mark "!" which does not show up very well here.

[edited by: HarryM at 10:46 am (utc) on Oct. 13, 2005]

Twisted Mind

10:46 am on Oct 13, 2005 (gmt 0)

10+ Year Member



thank you i knew it but i totally forgot it u guys are the best :)

omoutop

10:48 am on Oct 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



thats right HarryM!

u can also use
"if(var1 <> var2)" isnt it?

////////////////////////////////////
== equals
=== identical
!= not equal
<> not equal
////////////////////

Twisted Mind

11:07 am on Oct 13, 2005 (gmt 0)

10+ Year Member



sounds logical:) im doing php almost a month now...

jatar_k

3:37 pm on Oct 13, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



here's the operator portion of the manual for future reference

[php.net...]