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: