+ 1
What is defference between ' & " for echo in php?
2 ответов
+ 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.
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: