Home > PHP, Tips > Single Quotes vs Double Quotes!

Single Quotes vs Double Quotes!

September 14th, 2006 Leave a comment Go to comments

I recommend using ‘ (single quotes) when programming with PHP; Always use ‘ (single quotes) unless you need the features of ” (double quotes). You might think it’s much easier to write code as:

echo "Today is the $day of $month";

However, using single quotes forces variables to be outside the quotes; instead when you use the ” (double quotes), forces php to evaluate the string, where as with ‘ (single quotes), the string content is taken as such.

Categories: PHP, Tips Tags: ,
  1. No comments yet.
  1. No trackbacks yet.

+ thirty three = forty one