Now that you have some basic information about variables and know how to create them, let's turn to the important concept of quotation marks. PHP, like most programming languages, supports both double (“) and single (‘) quotation marks—but each gives entirely different results.
The rule of thumb is: items within single quotation marks are treated literally, while items within double quotation marks are extrapolated (that is, a variable’s name is replaced with its value, as you saw in Script 2-3). This rule applies anywhere in PHP you may use quotation marks, including the creation of string variables and using the print() function. Working through an example is the best way to learn.
In this exercise you will work with both single and double quotation marks to see the difference in action.
Script 2-4: The type of quotation mark you use with variables is vital to the end result.
Links
[1] https://www.studyanywhere.ca/advanced-courses/intro-php/chapter-2/variables/exercise-5
[2] https://www.studyanywhere.ca/advanced-courses/intro-php/chapter-2/variables/exercise-5#open_here
[3] https://www.studyanywhere.ca/advanced-courses/intro-php/chapter-1/getting-started-with-php/exercise-1#anchor
[4] https://www.studyanywhere.ca/advanced-courses/intro-php/chapter-2/variables