+ 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?
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
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#.
0
in Java for String you use double quotes and for char single quotes.