Source Code:
(back to article)
<?php // Example 1 $age = 25; $hasID = true; if ($age >= 18 && $hasID) { echo "You may enter the club." . PHP_EOL; } // Output: You may enter the club. // Example 2 $username = "admin"; $password = "password123"; if ($username == "admin" && $password == "password123") { echo "Access granted." . PHP_EOL; } // Output: Access granted. // Example 3 $isWeekday = true; $time = "12:30"; if ($isWeekday && $time >= "09:00" && $time <= "17:00") { echo "The office is open." . PHP_EOL; } // Output: The office is open.
Result:
Report an issue