Categories
Why does the php code produce such a result?
function getRemainder($a, $b) { return $a % $b; } echo getRemainder(50, 7);
Answer the question
In order to leave comments, you need to log in
Actually, 50% 7 = 7 and 1 in the remainder, which is what the function returned! Check: 7 * 7 + 1 = 50.
This is modulo division, that is, you get the remainder. Result 1.
Didn't find what you were looking for?
Ask a Question
731 491 924 answers to any question