Home / PHP Tips Generated By ChatGPT / Checking if a Number is Even or Odd in PHP Determine if a number is even or odd by using the modulo operator %. Source Code $number = 4; if ($number % 2 == 0) { echo "The number is even."; } else { echo "The number is odd."; }