There is a simple way in PHP to find out, wheather a number is odd or even. All you need is the modulo operator.

## What is the modulo operator?

The modulo operator in PHP is represented by an %. With this operator you can determine the rest of an interger division.

Here’s an example:

Read morePHP: How Can I Find Out, Whether A Number Is Odd Or Even With The Modulo Operator?

Advertisement