I simply want to know if $x is evenly divisible by $y. For example's sake assume:
$x = 70;
$y = .1;
First thing I tried is:
$x % $y
This seems to work when both numbers are integers but fails if they are not and if $y
is a decimal less than 1 returns a "Division by zero" error, so then I tried:
fmod($x,$y)
Which returns equally confusing results, "0.099999999999996".
php.net states fmod()
:
Returns the floating point remainder of dividing the dividend (x) by the divisor (y)
Well according to my calculator 70 / .1 = 700
. Which means the remainder is 0. Can someone please explain what I'm doing wrong?