In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "what is the difference between identity and equality in php". In daily operation, I believe that many people have doubts about the difference between identity and equality in php. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for everyone to answer the question of "what is the difference between identity and equality in php?" Next, please follow the editor to study!
Differences: 1, identity uses the "= =" operator for calculation, but equals to use the "= =" operator for calculation; 2, the equals operation only tests whether the left variable has the same value as the right variable, and the identity operation tests not only whether the value is the same, but also whether the data type is the same.
Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
Comparison of identity and equality in php
Equation (= =) operation
The equality (= =) operator compares and tests whether the variable (expression or constant) on the left has the same value as the variable (expression or constant) on the right; the comparison is loose.
If the two values are the same (it only compares the value of the variable, not the data type), the true value is returned; if the two values are different, the false value is returned.
Note: the equality (= =) operator is different from the assignment (=) operator. The assignment (=) operator changes the variable on the left, assigning the variable on the right to the variable on the left, while the equality (= =) operator tests equality and returns true or false based on the comparison result.
Example:
Identity (= =) operation
The identity (= =) operator makes a strict comparison between a given variable or value; it compares and checks whether two variables (expressions or constants) are equal in value and have the same data type, that is, both are strings or both are integers, and so on.
If two variables (expressions or constants) contain the same value and the same data type, this operator returns true, otherwise it returns false.
Example:
At this point, the study of "what is the difference between identity and equality in php" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 232
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.