![]() |
VOOZH | about |
The modulo operator in PHP is represented by the percentage symbol %. It calculates the remainder of one number divided by another. The basic syntax for the modulo operator is-
Syntax:
$result = $num1 % $num2;
Here, $num1 is the dividend, and $num2 is the divisor. The result will be the remainder after dividing $num1 by $num2.
Example 1: This example describes the Basic Modulo Operation.
Remainder is: 1
Example 2: This example checks for Even or Odd Numbers.
7 is an odd number.