Single vs. Double Quotation Marks
In PHP it’s important to understand how single quotation marks differ from double quotation marks. With the echo() and print() statements you can use either, as in the examples in this chapter. But there is a specific difference between the two and why you might use them. So far I’ve told you when you would use which, but now it’s time to establish the pattern more explicitly.
In PHP, values enclosed within single quotation marks will be treated literally, whereas those within double quotation marks will be interpolated. In other words, placing variables and special characters (Table 1.2) within double quotes will have their represented values printed, not their literal values. For example, assume that you have ...
Get PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.