What´s the difference between:
$sql = "select * from {$table}";
and this:
$sql = "select * from ".$table;
Are there any differences?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There isn’t much of a difference other than one uses concatenation and one doesn’t.
You can also write it as
You can use
{}in your string to refer to objects as well.If table were a name or array
I personally use it to increase readability, because I’ll always know I’m referring to a variable.