Last active
August 29, 2015 14:25
-
-
Save renatorib/c3d9b9837cd9759c3807 to your computer and use it in GitHub Desktop.
Change a phrase and store in session ever X seconds
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 | |
| session_start(); | |
| $phrases = array( | |
| 'Schizophasia, a mental condition characterized by incoherent babbling (compulsive or intentional, but nonsensical)', | |
| 'Logorrhea, a mental condition characterized by excessive talking (incoherent and compulsive)', | |
| 'Clanging, a speech pattern that follows rhyming and other sound associations rather than meaning', | |
| 'Graphorrhea, a written version of word salad that is more rarely seen than logorrhea in people with schizophrenia.' | |
| ); | |
| $seconds = 10; | |
| if(time() % $seconds == 0 || !isset($_SESSION["phrase"])){ | |
| $_SESSION["phrase"] = $phrases[rand(0, count($phrases)-1)]; | |
| } | |
| echo $_SESSION["phrase"]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment