ITP

BCA - PHP and MySQL

Difference between single quote string and double quote

In : BCA Subject : PHP and MySQL

Variable expansion is not supported by single quotes, but it is supported by double quotes.
If a variable is placed in a string using single quotes, the variable's value will not be substituted in the string.

e.g.

<?PHP

$str = ‘datahere’;

echo ‘$str is a site which provides tips.’;

?>

Output will be: $str is a site which provides tips.

In case of double quoted string…

<?PHP

$str = ‘datahere’;

echo “$str is a site which provides tips. “;

?>

Output will be: datahere is a site which provides tips.

Means if there is a string with double quotes and if you place a variable in that, it will substitute its value in string.

About us

A truly open platform where you may ask questions and get answers. We also provide comprehensive and easy-to-understand answers to question papers.  discover...

Site status

Flag Counter

Privacy Policy

Sitemap