Write a PHP program to check if two given non-negative integers have the same last digit.
<?php function test($x, $y) { return abs($x % 10) == abs($y % 10); } var_dump(test(123, 456)); var_dump(test(12, 512)); var_dump(test(7, 87)); var_dump(test(12, 45));
Sample Output:
bool(false) 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:
need an explanation for this answer? contact us directly to get an explanation for this answer