Home   |   About   |   Terms   |   Contact    
Read & Learn
 

What is the difference between Single quoted & Double quoted String in PHP?

PHP Articles

☯ All PHP Articles     ☯ All Articles


A new product.






Popular Google Pages:




This article is regarding
What is the difference between Single quoted and Double quoted String in PHP?
Last updated on: .



◕ What is the difference between Single quoted and Double quoted String in PHP?
Let have an example:
<?php
echo 'Hi RiyaButu!';
echo "Hi RiyaButu!";
?>

What is the difference between the Single quoted & the Double quoted string in the above example?

Let have another example for the answer:
<?php
$xyz = 10;
echo 'I have $xyz pens.';
echo "I have $xyz pens.";
?>

This will print like this:
I have $xyz pens.
I have 10 pens.

This means that, if we put a variable ($xyz) inside a Single quoted String then the variable will not replace itself with its value.
But if we put a variable ($xyz) inside a Double quoted String then the variable will replace itself with its value.

Different ways to define Strings in PHP.
What is Here Document?




Related articles:
Difference between Single quoted string & Double quoted string
Different way to define string in PHP?
What is Here Document in PHP?
What is PHP?
How Browser communicates with Server?
How PHP Works?
How to use PHP inside HTML?





Popular Google Pages:





Top of the page

Amazon & Flipkart Special Products

   


Top of the page