Skip to content

Instantly share code, notes, and snippets.

@vhdm
Created September 6, 2015 22:16
Show Gist options
  • Save vhdm/81a044cf9e5c60a0c3cc to your computer and use it in GitHub Desktop.
Save vhdm/81a044cf9e5c60a0c3cc to your computer and use it in GitHub Desktop.
Word of the day
<?php
function wordofday(){
$filename = "words.txt";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
fclose($handle);
$array = explode("\n",$contents);
$date = date("z");
if($date > count($array)){
return $array[0];
}else{
return $array[$date];
}
}
echo '<p>&nbsp;</p><p>'.wordofday().'</p>';
?>
Take me out to the ball game
Take me out to the park
Buy me some peanuts and crackerjacks
I don't care if we ever get back
Root, root, root for the home team
If they don't win its a shame
For its one, two, three strikes your out
at the old ball game.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment