In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the relevant knowledge of "what is the difference between single quotation marks and double quotation marks in PHP". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Many programmers think that single quotation marks and double quotation marks are the same in PHP, but it depends on how they are used. They are the same in some ways, but they are also very different in some aspects. Today, the editor will tell you what the differences are.
1. In general, the two are universal. But if the variable is written in double quotes, the parsing operation will be performed, while the single quotation marks will not be parsed. Let me give you an example.
Can you see it now?
2. The execution efficiency is different, and the execution speed of single quotation marks is faster than that of double quotation marks. If it is the same large program, we should pay attention to optimization in this respect. After all, PHP is an interpretive language. So if there is only a pure string inside, using single quotation marks (fast) and other things (such as variables) inside it will be more flexible.
Small hidden trouble of PHP double quotation marks
There are many syntax features of PHP that can be used by attackers, such as PHP to detect variables in double quotes.
Execute the following code:
Function test () {echo "abc";} echo "${@ test ()}"; / / or echo ${@ phpinfo ()}
The principle is as follows:
This is the end of the introduction of "what's the difference between single quotation marks and double quotation marks in PHP". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.