View Single Post
Old 10-01-2006, 05:59 PM   #2 (permalink)
StupidScript
Inactive
 
StupidScript's Avatar
 
Join Date: 09-22-06
Location: Los Angeles
Posts: 678
iTrader: 0 / 0%
Latest Blog:
None

StupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really nice
That comparison operator means "identical to".

Here's a quick cheatsheat:

ASSIGNMENT OPERATOR:
Code:
= Example: x = y; Used to SET variable x equal in every way to variable y.
COMPARISON OPERATORS:
Code:
== Example: if (x == y) Used to COMPARE variable x to variable y. If they are of the same VALUE, it matches
Code:
=== Example: if (x === y) Used to COMPARE variable x to variable y. If they are of the same VALUE and the same TYPE, it matches
Code:
!= Example: if (x != y) Used to COMPARE variable x to variable y. If they are not of the same VALUE, it matches
Code:
!== Example: if (x !== y) Used to COMPARE variable x to variable y. If they are not of the same VALUE and TYPE, it matches
I usually use the "identical" comparison operator when I am pulling an integer from a database. This is because any value greater than 0 can be interpreted as a boolean "true" value.

Code:
if (x == 1) 1 is an integer that will match if x has any value, even if x is a string.
Code:
if (x === 1) 1 is an integer that will match if x's value is 1 AND if x's type is "integer".

Last edited by StupidScript : 10-01-2006 at 06:02 PM.
StupidScript is offline   Reply With Quote