Write a PHP program that accept two integers and return true if either one is 5 or their sum or difference is 5
<?php function test($x, $y) { return $x == 5 || $y == 5 || $x + $y == 5 || abs($x - $y) == 5; } var_dump(test(5, 4)); var_dump(test(4, 3)); var_dump(test(1, 4));
Sample Output:
bool(true) bool(false) bool(true)
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer