November 13th, 2013, 03:41 PM
Single Quote or Double quotes
Okay I have found several examples going one way or the other as to which way is better and which way is better for several different needs. I thought I would just ask one more time for me and for all those wondering people in the world.
Which way is more proper?
echo "<td><input type=\"number\" size=\"18\" name=\"add_quantity_aEdit\"></td>";
echo '<td><input type="number" size="18" name="add_quantity_aEdit"></td>';
November 13th, 2013, 03:48 PM
isn't that obvious? Unless you really like backslashes, you should never use double quotes in a double-quoted string or single quotes in a single-quoted string.
If you wonder about the difference between single quotes and double quotes: Double-quoted strings get evaluated and can contain variables or special character sequences like \n (a newline). A single quoted string is a raw sequence of characters. It's generally safer to use single quotes, because you don't run into trouble if your string happens to contain a "$" or something.