What is defference between ' & " for echo in php? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is defference between ' & " for echo in php?

7th Sep 2016, 2:45 PM
Vishal Prajapati
2 Answers
+ 2
In double quation we can use variable by using curly brackets like <?php echo "hi {$var} , how are you?"; ?> The same can not be done in single quotation.
7th Sep 2016, 2:47 PM
Vishal Prajapati
0
you can place variables inside " but you cannot inside single quotation ' let's say you have a variable called $name and you want to print Hi followed by the value of the name variable: $name ="Vishal"; echo "Hi $name": or echo "Hi {$name}": these will print Hi Vishal but when using single quotation: echo 'Hi $name': it will print Hi $name not Hi Vishal:
2nd Nov 2016, 3:17 PM
Hasan Al-Yazidi
Hasan Al-Yazidi - avatar