Working with modulus

The operand modulus provides the remainer when $x is divided by $y

This can be especially useful to detect if a number is odd or even

If $x % (that's the character in php used) 2
expressed as $x % 2
the answer is either 0 or 1
and that will tell you in $x is odd or even

Try it out for yourself

%

Back to Home