? is basically a shorthand for some types of if-statements.
PHP Code:
condition ? value_if_true : value_if_false
i.e.
PHP Code:
temp.var = "";
if (x > 3) {
temp.var = "x was more than 3";
} else {
temp.var = "x was less than 3";
}
is equivalent to
PHP Code:
temp.var = (x > 3) ? "x was more than 3" : "x was less than 3";
As for modulus, think of it like remainder.
PHP Code:
3 % 3 // 0
5 % 3 // 2
6 % 5 // 1
10 % 7 // 3