alright, i'm trying to understand the way this works...i mean i do, but i want to see why...i confused?

alright, i'm alternating row colors...
i use this:
PHP Code:
$i 0;
if (
$i++ % == 0) { $bg "#0E377C"; } else { $bg "#266BB1"; } 
the way i see it is i will first equal zero no problem there, but the next line, to me would mean that i is going to step up (to 1 the first time, right?) and it needs to equal 0 to equal $bg = "#0E377C", otherwise it will equal $bg = "#266BB1", but what are the nubers exactly..

like why does i incrementing by one need the mod 2? what does that equal anyways...and so does this mean that everyother increment equals 0?

can someone break it down so that i might understand those two lines?