&&를 사용하는 경우 두 조건이 모두 true여야 하기 때문입니다. 하나의 조건이 거짓이 되면 전체 조건은 거짓으로 평가됩니다.
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