Created
March 8, 2016 15:32
-
-
Save zeraphie/06119f0908244e893c54 to your computer and use it in GitHub Desktop.
Get today's item from a list of items
This file contains 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
function todays_item($arr){ | |
$count = count($arr); | |
$number = floor(time() / 86400) % $count; | |
return $arr[$number]; | |
} | |
$arr = array( | |
'One', | |
'Two', | |
'Three' | |
); | |
echo todays_item($arr); |
Author
zeraphie
commented
Jan 13, 2017
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment