Is there a better way, other than my following example, to find if a number is a multiple of a number?
My klunky way would be to keep subtracting x from y and look for a zero value. This seems like a long haul if I have to keep subtracting say, 4 from 123456789, or something like that.
$x = 4; $y = 123456789; while($y > 0) { $y -= $x; if($y == 0) { #..... } }
Is there a better way?
Thank you.
In reply to Find if a number is a multiple of a number. by Baratski
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |