Thread: Array help
View Single Post
  #19  
Old 08-31-2011, 10:39 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
? 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 
__________________
Reply With Quote