I got problem with this code:
if (!empty($_GET[ "lic" ])) $lic = $_GET[ "lic" ]; else $e = true;
echo ($lic % 11);
When I post 8911076856 it echoes 1, but it should be 0.
The value "8911076856" is probably above the maximum integer value of your system.
echo ((int)8911076856);
My result is 321142264 on my 32 Bit system.
fmod() over (float)$x % (float)$y just the precision of the result?(float)$x % (float)$y does not give the correct result for values of $x above PHP_INT_MAX. E.g. (float)8911076856 % (float)10 gives 4 instead of 6. Apparently the modulo operator casts both arguments back to int.This is most likely being caused because the number you're posting is higher than PHP_INT_MAX, which is 9223372036854775807 on most 64-bit systems AFAIK. If you're using a 32-bit system (which I expect you are), it's probably 2147483647.
8911076856is too high for an int, and overflowing?var_dump(8911076856 % 11);returnsint(0). Callvar_dump($lic)before echoing the modulo.8911076856is parsed as afloat, but cast internally to anintegerfor the modulus. Tryvar_dump((int)8911076856);to see what it's actually using in the operation.