+ 2

In what languages single and double quotes behave differently and what's their difference?

For example, in C++ single quotes are used to define a char, and double quotes, a char pointer or string. In what other languages are different? I heard that in js one of them(i dont know which) creates potential problems regarding the security of the script. In what other languages is the behaviour different?

30th Apr 2017, 3:27 PM
Bebida Roja
Bebida Roja - avatar
3 Antworten
+ 3
In PHP double quotes make variable access posible, single quote no. Example: $myvar = "sololearn"; echo "I like $myvar"; echo 'I like $myvar'; First line output: I like sololearn second line output: I like $myvar
30th Apr 2017, 3:50 PM
⏩▶Clau◀⏪
⏩▶Clau◀⏪ - avatar
0
No, there is nothing quotes related in JavaScript. Unless you write JSON object. In JSON you have to write string in double quote. In PHP, your PHP code will compile if it is in double quote but not with single. Java has same as c, c++, c#.
30th Apr 2017, 3:41 PM
Aditya kumar pandey
Aditya kumar pandey - avatar
0
in Java for String you use double quotes and for char single quotes.
30th Apr 2017, 3:55 PM
Claudiu Cirtina
Claudiu Cirtina - avatar