Q:

Write a PHP program to check two given integers, and return true if one of them is 30 or if their sum is 30

0

Write a PHP program to check two given integers, and return true if one of them is 30 or if their sum is 30

All Answers

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

<?php
function test($x, $y) 
{
    return ($x == 30) || ($y == 30) || ($x + $y == 30);
}

var_dump(test(30, 0));
var_dump( test(25, 5));
var_dump( test(20, 30));
var_dump(test(20, 25));
 Sample Output:
bool(true)
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