To check if a number $day is divisible by divisor(3), use the modulus operator, %:
If the number divisible by 3 then the modulus will return remainder 0, so the if condition will fail so add your logic in else condition.
(OR)if ($day % 3) { # does not divide cleanly } else { # does. }
Even you can use the same as your if(($day%3) == 0) condition of checking the reminder is equal to 0. In this case you can add your logic in if(..) itself
In reply to Re: modulus question
by vinoth.ree
in thread modulus question
by healingtao
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |