The division operator ("/") returns a float value unless the two operands
are integers (or strings that get converted to integers) and the numbers
are evenly divisible, in which case an integer value will be returned. For
integer division, see intdiv().

Operands of modulo are converted to integers (by stripping the decimal
part) before processing. For floating-point modulo, see
fmod().

The result of the modulo operator % has the same sign
as the dividend — that is, the result of $a % $b
will have the same sign as $a. For example:

The modulus operator is very poorly suited for such a simple operation as determining if an int is even or odd. On most common systems, modulus performs a division, which is a very slow operation.A much better way to find if a number is even or odd is to use the bitwise & operator.

It is worth noticing that when working with large numbers, most noticably using the modulo operator, the results depend on your CPU architecture. Therefore, running a decent 64-bit machine will be to your advantage in case you have to perform complex mathematical operations. Here is some example code - you can compare its output on x86 and x86_64 machines:<?php/* tested under PHP 5.2.6-1 with Suhosin-Patch 0.9.6.2 (cli) on both i386 and amd64, Debian lenny/sid */$a = 2863311530;$b = 256;$c = $a % $b;echo "$c <br />\n";echo (2863311530 % 256)." <br />\n"; /* directly with no variables, just to be sure */?>

The code is expected to produce '170' if working correctly (try it in spreadsheet software).