What exactly does this mean?
$number = ( 3 - 2 + 7 ) % 7;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s the modulus operator, as mentioned, which returns the remainder of a division operation.
Examples:
3%5returns 3, as 3 divided by 5 is 0 with a remainder of 3.5 % 10returns 5, for the same reason, 10 goes into 5 zero times with a remainder of 5.10 % 5returns 0, as 10 divided by 5 goes exactly 2 times with no remainder.In the example you posted,
(3 - 2 + 7)works out to 8, giving you8 % 7, so$numberwill be1, which is the remainder of 8/7.