This is because if you use && both conditions must be true. If any one condition becomes false then the overall condition evaluates to false.
The PHP code is as follows −
Example
<!DOCTYPE html> <html> <body> <?php $firstCondition= "John"; $secondCondition = "David"; if ($firstCondition == "John" && $secondCondition == "David" && ($firstCondition == "Mike" || $firstCondition == "John")) { echo "The above condition is true"; } else { echo "The above condition is not true"; } ?> </body> </html>
Output
The above condition is true