Skip to content

Instantly share code, notes, and snippets.

@renatorib
Last active August 29, 2015 14:25
Show Gist options
  • Select an option

  • Save renatorib/c3d9b9837cd9759c3807 to your computer and use it in GitHub Desktop.

Select an option

Save renatorib/c3d9b9837cd9759c3807 to your computer and use it in GitHub Desktop.
Change a phrase and store in session ever X seconds
<?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