Wednesday, 17 September 2014

What are Difference between (= =) and (= = =) this Two Relational Operators ?

            What are Difference between (= =) and (= = =) this Two                              Relational Operators ?

Ans:-   The  Relational Operator (a = = = b)
                  a = = = b                    a = = b when a and b are two string objects that contain equivalent characters, the = = = operator will still return true.


For e.g :-

The languages JavaScript and PHP extend this syntax, with the "= =" operator able to return true if two values are equal, even if they have different types.

(for example: "4 = = "4"" is true) and the "= = =" operator returning true only if two values are equal and have equivalent types as well (such that "4 = = = "4"" is 

false but "4 = = = 4" is true). This comes in handy when checking if a value is assigned the value of 0, since "x = = 0" is true for x being 0, but also for x being "0" 

(i.e. a string containing the character 0) and false (as PHP, like other languages, equates 0 to false), and that is not always what one wants, but "x = = = 0" is only 

true when x is 0. When comparing objects in PHP 5, the "= =" operator tests for structural equality, while the "= = =" operator tests for physical equality.







No comments:

Post a Comment