I just did a syntax like this
mysql_real_escape_string($var = 'Hello');
print_r($var);
and I got the echo of Hello, so I wondering is that syntax legal in PHP? if not why doesn’t PHP trigger an error that is not legal?
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.
That’s legal, although it won’t do what you want.
Hellois assigned to$varand then the value is used as an argument to call the function.However,
$varwill not be escaped this way! The return value ofmysql_real_escape_string()will be lost.So don’t do this. The right way to do it would be