30 seconds of PHP

  Back to Home

isEven

mathbeginner

Returns true if the given number is even, false otherwise.

Checks whether a number is odd or even using the modulo (%) operator. Returns true if the number is even, false if the number is odd.

function isEven($number)
{
  return ($number % 2) === 0;
}