How do the PHP equality (== double equals) and identity (=== triple equals) comparison operators differ? Last Updated : 07 Jan, 2022 Comments Improve Suggest changes Like Article Like Report Equal Operator == The comparison operator called Equal Operator is the double equal sign "==". This operator accepts two inputs to compare and returns true value if both of the values are same (It compares only value of variable, not data types) and return a false value if both of the values are not same. This should always be kept in mind that the present equality operator == is different from the assignment operator =. The assignment operator changes and assigns the variable on the left to have a new value as the variable on right, while the equal operator == tests for equality and returns true or false as per the comparison results.Example: php <?php // Variable contains integer value $x = 999; // Variable contains string value $y = '999'; // Compare $x and $y if ($x == $y) echo 'Same content'; else echo 'Different content'; ?> Output: Same content Identical Operator === The comparison operator called as the Identical operator is the triple equal sign "===". This operator allows for a much stricter comparison between the given variables or values. This operator returns true if both variable contains same information and same data types otherwise return false.Example: php <?php // Variable contains integer value $x = 999; // Variable contains string value $y = '999'; // Compare $x and $y if ($x === $y) echo 'Data type and value both are same'; else echo 'Data type or value are different'; ?> Output: Data type or value are different In the above example, value of $x and $y are equal but data types are different so else part will execute. Comment More infoAdvertise with us Next Article How do the PHP equality (== double equals) and identity (=== triple equals) comparison operators differ? R rajusinghbhati Follow Improve Article Tags : Web Technologies PHP Similar Reads Strict Inequality(!==) Comparison Operator in JavaScript JavaScript Strict Inequality Operator is used to compare two operators and return true if they both are unequal. It is the opposite of the Strict Equality operator but like the Strict Equality Operator, it also does not perform type conversion. Syntax: a!==b Example 1: In this example, we will use t 1 min read Strict Equality(===) Comparison Operator in JavaScript JavaScript Strict Equality Operator is used to compare two operands and return true if both the value and type of operands are the same. Since type conversion is not done, so even if the value stored in operands is the same but their type is different the operation will return false. Syntax: a===b E 2 min read Difference between double equal vs triple equal JavaScript Double equal: The double equal('==') operator tests for abstract equality i.e. it does the necessary type conversions before doing the equality comparison. Triple equal: The triple equal('===') operator tests for strict equality i.e it will not do the type conversion hence if the two values are not 2 min read Inequality(!=) Comparison Operator in JavaScript JavaScript Inequality operator is used to compare two operands and returns true if both the operands are unequal it is basically the opposite of the Equality Operator. It is also called a loose inequality check as the operator performs a type conversion when comparing the elements. Also in the case 2 min read Difference between the (=), (==), and (===) operators in PHP In PHP, the '=' operator is used for assignment, while the '==' operator is used for loose equality comparison, meaning it checks if two values are equal without considering their data types. On the other hand, the '===' operator is used for strict equality comparison, meaning it checks if two value 3 min read Like