Difference between == and === operator in PHP


When you want to compare values in PHP then you can use either == or === operator. But these both operator are not same. It’s good to know the difference between them.

These both operators fall under the category of Comparison Operators. The first operator ‘==’ is known as Equal Operator in PHP and checks for the equal values and the second operator ‘===’ is known as Identical Operator and checks for equal values and it also checks that if both the values are of same variable type or not.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s