Don't know what this does
I was following a tutorial I found about some database class and it uses the following code:
Thanks in advance.
it checks if the number $i (I am guessing $i value's is a number) is odd or even/
The modular or mod (%) returns the reminder of the division, such as if the statement is 4%3 it would be the reminder of the 4/3 division which in this case example is 1.
On the example code you gave if anything divided by 2 doesn't return 0 then the nominator is odd. I think it is a mathematical way to find odd or even numbers.
Yep, the modulo operator returns the remainder of division of one number by another.
The above code could be condensed slightly. Because PHP treats return values of anything other than False/Null or '0' etc as true, we can just do this:
|All times are GMT. The time now is 06:45 AM.|
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0