Skip to main content
Known Participant
Dec 24, 2010 5:36 PM UTC
Question

looking for clear explanation modulo operator

Hi, can someone please explain to me (a person with no mathematical background) the modulo operator. I need to understand it, because I'm learning

PHP at the moment.

Thanks!!!

This topic is closed to new replies. Start a new post to keep the conversation going.

2 replies

David_Powers
Inspiring
Dec 24, 2010 11:23 PM UTC

BITESGIRL wrote:

Hi, can someone please explain to me (a person with no mathematical background) the modulo operator.

Please do not post the same question in multiple forums. You also posted this question as a private message to me. Doing so wastes the valuable time of everyone who responds, and is likely to result in your future questions being ignored.

Translate
Randy Edmunds
Adobe Employee
Adobe Employee
Dec 24, 2010 10:43 PM UTC

It's the remainder of an integer division operation. For example, consider 6/4 (six divided by four):

For floating point math, the answer is: 1.5

But, for integer math, the fraction is thrown away and the answer is: 1. There's no way to know if there's a remainder for the division operation, so the modulo operation is provided to get the remainder, which is 2.

HTH,

Randy

Translate