![]() |
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. PHP
Output
Remainder is: 1 Example 2: This example checks for Even or Odd Numbers. PHP
Output
7 is an odd number. |
Reffered: https://www.geeksforgeeks.org
Geeks Premier League |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 13 |