In PHP, the definition of a string can use single quotation marks ", or you can use double quotation marks" ".
However, you must use the same single or double quotation marks to define strings, such as: ' Hello World ' and ' Hello World ' are illegal string definitions.
What's the difference between a single quote and a double quote?
PHP allows us to include string variables directly in a double quote string.
The contents of a single quote string are always considered ordinary characters, so the content in single quotes is not escaped more efficiently.
Like what:
$str = ' Hello '; echo "str is $STR"; Operation Result: STR is Helloecho ' str is $str '; Operation Result: STR is $STR
In PHP, the 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).
Using the words, I used to like to write in the SQL string $sql = "SELECT * FROM table where id = $id", so that the inside of the $id can be escaped, single quotation marks will not work.
There is no difference between single and double quotes in JavaScript, as long as paired use is OK.
I use single quotes in JavaScript mostly because JavaScript deals more with HTML, and you don't need to escape the quotes of attributes in HTML when outputting HTML fragments.
In short, see the actual situation, how convenient how to use.