Are equivalents these statements?
if ($a || $b && $c)
{
// ...
}
if (($a || $b) && $c)
{
// ...
}
EDIT
What a beating! But worth it… THX to all!
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.
Answer: NO. They’re not equivalent.
Check out the PHP Operator Precedence table. It clearly lists
&&before||.See it here in action: http://viper-7.com/cPycas
If you want to use precedence instead of parenthesis, you can use the more verbose
AND:Here’s the demo, but I’d advise you against it, since it’s not as clear as parenthesis.