Using Single and Double Quotes in PHP

Examples

Double quotes: Hello, $ john!

Single quotes: Hello, $larry!

Difference Between Single and Double Quotes

In PHP, double quotes allow variables to be interpreted inside the string, so the value of $name is displayed when the string is printed. Single quotes treat the text more literally, so the variable name is displayed instead of its value. Double quotes are useful when you want PHP to recognize variables and special characters, while single quotes are useful when you want the text to remain mostly unchanged.