Write a PHP program to check a given integer and return true if it is within 10 of 100 or 200
<?php function test($x) { if(abs($x - 100) <= 10 || abs($x - 200) <= 10) return true; return false; } var_dump(test(103)); var_dump(test(90)); var_dump(test(89));
Sample Output:
bool(true) bool(true) bool(false)
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: