Created
January 21, 2013 05:36
-
-
Save vrushank-snippets/4583841 to your computer and use it in GitHub Desktop.
PHP : ODD - EVEN CLASS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for($i=0;$i<10;$i++) | |
{ | |
echo "<div class=class".($xyz++%2).">Hello</div>"; | |
} | |
// OR | |
for($j=0;$j<10;$j++) | |
{ | |
$class = ($j%2 == 0)?'even':'odd'; | |
echo "<div class=$class>Hello</div>"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment