Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Which is the equivalent of the C 'mod' function? 1

Status
Not open for further replies.

arlequin

Programmer
Sep 21, 1999
232
UY
Hello!

I want to paint a table generated from a sql query.

I iterate a variable and want to paint the <TD> in grey when dividing its value by 2 is zero.(Even number).

Which is the sintax of the equivalent function in PHP to C's mod ?


Thanks a lot. Arlequín
arlequin@montevideo.com.uy
 
I think you want the modulo operator. It's used like this:
if ($value % 2 == 0)
{
// do stuff
}
I hope this is what you want. //Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top