Help me out here on Php quotation marks | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help me out here on Php quotation marks

Can you pls explain the difference between single and double quotation marks in php used on variables. For example, $num1 = '1'; $num2="5"; echo "$num1+ $num2"; What will be the out here? Thank you for the answer in advance.

21st Jul 2018, 12:38 PM
Ikboljon Sobirov
Ikboljon Sobirov - avatar
2 Answers
0
There is no difference. Just make sure to use the same ones to open and close the string. Examples: Good: "Hi!" Bad: "Hi!' You can also use the single quotes inside double quotes and the other way round. Examples: Good: "Paul's answer" Bad: 'Paul's answer' Hope I could clarify things a little! :)
21st Jul 2018, 12:58 PM
Paul Grasser
Paul Grasser - avatar
0
thank you Paul Grasser, I kinda know what u just said; but can u see the echo statement, it has quotation marks for variables. What would that be like? I had this in one of the challenges I had
21st Jul 2018, 2:27 PM
Ikboljon Sobirov
Ikboljon Sobirov - avatar