Created
July 13, 2012 07:49
-
-
Save 2dpi/3103448 to your computer and use it in GitHub Desktop.
PHP: array odd and even
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
<?php | |
/* add a class to define odd and even output from an array */ | |
echo ($key%2) ? " even" : " odd"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment