In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "is the speed of identity operator faster than equality operator in php". In daily operation, I believe that many people have doubts about whether the speed of identity operator in php is faster than that of equality operator. Xiaobian consulted all kinds of data and sorted out a simple and useful method of operation. I hope it will be helpful to answer the question of "is the speed of identity operator faster than equality operator in php?" Next, please follow the editor to study!
The comparison operator = (equality operator) and = (identity operator) are used to compare two values. They are also called loose equals (= =) and strict equals (=) operators.
There are many operators in the PHP operator PHP, but the = and = = operators perform similar tasks strictly or at will.
If the two values are of different types, then = and = = will get different results. The speed of the operation will also be different, because = = will convert the type first and then compare it.
If the two values are of the same type, then = and = = will get the same result. The operation speed is almost the same, and neither operator is type-converted.
The equality operation = = when comparing two values temporarily converts the data type, while the = = (congruence operator) does not need to perform any type conversion, so the amount of computation is reduced and faster.
Case 1:
Output:
Bool (true)
Bool (true)
Bool (true)
Bool (true)
Bool (false)
Bool (false)
Bool (false)
Bool (false)
In first case
Case 2:
Output:
Bool (true)
Bool (true)
Bool (false)
Bool (false)
Note: the = operator 'type is relatively safe', TRUE is returned only if two values have the same type and value, and when = = is used, equal values return TRUE.
At this point, the study of "is the identity operator faster than the equality operator 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: 0
*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.