How does the concept of "remainder" in division relate to determining if a number is even or odd using the Modula Operator in PHP?

To determine if a number is even or odd using the Modula Operator in PHP, we can check the remainder when dividing the number by 2. If the remainder is 0, the number is even; if the remainder is 1, the number is odd.

$num = 5;

if ($num % 2 == 0) {
    echo "$num is even";
} else {
    echo "$num is odd";
}