What is the Modulo Operator in PHP and how is it used to check if a number is divisible by another number?

The Modulo Operator in PHP is represented by the % symbol and returns the remainder of a division operation. To check if a number is divisible by another number, we can use the modulo operator to calculate the remainder when dividing the first number by the second. If the remainder is 0, then the first number is divisible by the second number.

$number = 10;
$divisor = 2;

if ($number % $divisor == 0) {
    echo "$number is divisible by $divisor";
} else {
    echo "$number is not divisible by $divisor";
}