Ok, so one of the threads on here got me thinking the other day, and I want to know the correct way to do things.
Whenever I have a variable that I want to print out in the middle of an echo string, I do the following:And now I've even seen the following on php.net:PHP Code:echo "I want to print this var: " . $var . " units;
No quotes, no indication to the processor that it's a php variable other than the dollar sign. Does it matter? Is one slower? And what's the difference between single and double quotes and when should I use either because right now the only time I use single quotes is in SQL queries in the WHERE clause.PHP Code:echo "I want to print this var: $var units";




Reply With Quote