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).