ऐसा इसलिए है क्योंकि यदि आप && का उपयोग करते हैं तो दोनों शर्तें सत्य होनी चाहिए। यदि कोई एक शर्त फाल्स हो जाती है तो समग्र कंडीशन फाल्स का मूल्यांकन करती है।
PHP कोड इस प्रकार है:
उदाहरण
<!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>
आउटपुट
The above condition is true