In php , while using echo we put d text to b displayed in quotation mrks but wen we use variables we dont put quotation mrks. Y? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

In php , while using echo we put d text to b displayed in quotation mrks but wen we use variables we dont put quotation mrks. Y?

25th May 2017, 11:22 AM
Koushikaa Dhinagar
Koushikaa Dhinagar - avatar
2 Answers
+ 2
Actually both are working even if u put double quotes between them. Have you tried?
25th May 2017, 11:24 AM
Ang
Ang - avatar
+ 1
yes, both are working. you can put a var inside your echo statement: <?php echo "hi, my name is $myName"; ?> but when you just echo an variable like: <?php echo $myName; ?> there is no need for quotation marks
25th May 2017, 12:32 PM
Markus
Markus - avatar