Q:

Write a PHP program to check if one given temperatures is less than 0 and the other is greater than 100

0

Write a PHP program to check if one given temperatures is less than 0 and the other is greater than 100

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

<?php
function test($temp1, $temp2) 
{
   return $temp1 < 0 && $temp2 > 100 || $temp2 < 0 && $temp1 > 100;
}

var_dump(test(120, -1));
var_dump(test(-1, 120));
var_dump(test(2, 120));

Sample Output:

bool(true)
bool(true)
bool(false)

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now