I've done this:
$year=2016
if(($year%4)==1){
...
}
I would like to know if a number divided by 4, its result is whole, that is to say.
2016/4 = 504, therefore it would enter the if.
I've done this:
$year=2016
if(($year%4)==1){
...
}
I would like to know if a number divided by 4, its result is whole, that is to say.
2016/4 = 504, therefore it would enter the if.
It's just like you're doing it, but changing the value of the comparison.
$year=2016
if(($year%4)==0){
...
}
The %
operator returns the remainder of the division. If the division is exact (no remainder), returns 0
.