Tuesday, May 24, 2011

Difference between '=', "==" and '===' in PHP

=        sign is an assignment - take what's on the right as an expression and save it in the variable named on the left.

==        sign is a comparison and tests whether the variable / expression / constant to the left has the same value as the variable / expression / constant to the right.

===        sign is a comparison to see whether two variables / expresions / constants are equal AND have the same type - i.e. both are strings or both are integers.

No comments:

Post a Comment