+ 4
Like in many other languages the % operator is known as modulo operator, it returns the remainder from division of left-hand operand by right-hand operand. There is this difference output in some language when the right-hand operand is greater than the left-hand one, but mostly, in such case, the operator returns the left-hand operand. Examples: echo (7 % 3); // 7 / 3 = 2 // Remainder 1 echo (10 % 2); // 10 / 2 = 5 // Remainder zero echo (0 % 3); // Zero can't be divided by 3. // Yields left-hand operand (zero) Hth, cmiiw
28th Mar 2019, 7:15 AM
Ipang