However, the same single or double quotation marks must be used to define strings. for example, 'Hello World "and" Hello World "are invalid strings.
What is the difference between single quotes and double quotes?
PHP allows us to directly include string variables in double quotation marks.
The content in a single quotation mark string is generally considered a common character, so the content in a single quotation mark is not escaped more efficiently.
The code is as follows:
$ Str = 'hello ';
Echo "str is $ str"; // running result: str is hello
Echo 'Str is $ str '; // running result: str is $ str
In php, variables ($ var) and special characters (\ r \ n) in double quotes are escaped, and the content in single quotes is not escaped (so it is more efficient ).
I used to like writing $ SQL = "SELECT * FROM table WHERE id = $ id" in the SQL string, so that the $ id in it can be escaped, and it won't work in single quotes.
In short, it depends on the actual situation and how to use it conveniently.
The above is an analysis of the difference between single double quotes in php. I hope you will like it.