Variable-substitution isn’t done when using single quotes (‘), meaning that the values in your first example would literally be $1 $2 etc if it was a regular string and not passed on to a function that replaces them.
If you don’t need variable-substitiution, it’s better to stick with single quotes for performance reasons.
“ invokes the shell-engine and invokes it as an actual command, and returning the result, just like in perl. Hence, it has a completely different meaning.
examples:
$email="[email protected]"; $sql1 = "SELECT user_id FROM users WHERE email = $email"; $sql2 = 'SELECT user_id FROM users WHERE email = $email';
$sql1 would be SELECT user_id FROM users WHERE email = [email protected]
$sql2 would be SELECT user_id FROM users WHERE email = $email