What different between single quotes and double quotes? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What different between single quotes and double quotes?

17th Jul 2016, 12:07 AM
Hairil Azfar
Hairil Azfar - avatar
4 Answers
+ 13
Is a little different, both print a string but if you have a variable $color='red'; you could do : echo "color is $color" (the output will be "color is red") but if you do : echo 'color is $color' (the output will be 'color is $color')
18th Jul 2016, 2:46 AM
Bashir Akle
Bashir Akle - avatar
+ 1
" i said to myself: "let's get this done!" " in this sentence, script wouldn't know how this will be typed. I started something with double quotes and then before the word LET the script will assume I have ended it with double quotes again. that's why (starting with LET) script will be faced with some weird stuff that's not a variant neither a string correct solution is: "I said to myself: 'let's get this done!' "
22nd Jul 2016, 3:17 PM
Dr.Na'el Hariri
Dr.Na'el Hariri - avatar
0
look dear..! There is no such difference between single and double quotes. Both are used to show strings. But the thing is some special characters like newline characters can only be used in double quotes and also if you are using double quotes then there is no need to use concatenation operator(.) to join two strings bu vise-versa not possible.
24th Jul 2016, 9:51 AM
Rahul Rai
Rahul Rai - avatar
0
i dont understand what are those steings
5th Aug 2016, 8:09 PM
lord montasir
lord montasir - avatar