When to use single quotes and double quotes in PHP - difference
What is difference between single quotes and double quotes in PHP. When should be each type of them used ?
Hi,
It may look there is no difference between single qutoes and double quotes when you use them for example to display some simple text:
echo "Abcde"; // will return Abcde
echo 'Abcde'; // will return Abcde
But you can find differences when you are using quotes for example in relation to some variables:
$value = 123;
echo "Abcde $value"; // will return Abcde 123
echo 'Abcde $value'; // will return Abcde $value
In some cases the usage of single or double quotes may be faster. Using single quotes for simple displaying of text can be faster than using double quotes:
echo 'Abcde'; // can be faster
echo "Abcde";
But using of double quotes in relation to some variable may be faster:
$value = 123;
echo "Abcde $value"; // can be faster
echo 'Abcde ' . $value;