q = intdiv(a, b) (truncates toward zero in PHP).r = a % b (in PHP, r has the same sign as a).a = q × b + r always holds for PHP’s intdiv and %.-17 % 5 = -2 in PHP (since the remainder follows the sign of a).rE = ((a % b) + |b|) % |b|.b to a non-zero integer.Choose which optional categories you allow. Necessary cookies are always on. Privacy Policy.