spiritssight wrote:". $POST['test']." // with and without '' or "" in the []
{$POST['test']} // with and without '' or "" in the []
Which is better, an apple or an orange? There is no definitive answer to that question - it's up to you to decide which fits your programming style better. I will say that either example without quotes inside the [] brackets is incorrect as this will generate an E_WARNING error message (array indexes are strings, not constants, unless you specifically [man]define/man'ed a constant and are intentionally using it).
spiritssight wrote:should one user ". $var ." or '. $var.' with a echo that has strings like html?
which one would be better when doing some thing with a db?
Again, should you buy an apple or should you buy an orange? It's up to you to decide - both will work.
There's nothing wrong with mixing the two, especially if it would make it easier to type rather than escaping every quote within the string. Example:
$author = 'Brad';
echo '<div id="comment">Since this is "HTML" code, and it has these double quotes ( " ), I used a single quote ( \' ) to delimit this string.</div>' . "\n";
echo "<p>Note that I, $author, mixed quote delimiters.</p>\n";