Given the statement:
if($value && array_key_exists($value, $array)) {
$hello['world'] = $value;
}
Would it be best to use the logical operator AND as opposed to &&?
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.
On their own, they do exactly the same. So
a && bmeans the same thana and b. But, they are not the same, as&&has a higher precedence thanand. See the docs for further information.This example here shows the difference: