Skip to content

Instantly share code, notes, and snippets.

@zarpio
Created October 6, 2015 10:34
Show Gist options
  • Save zarpio/38dbf8128c2c459be7d1 to your computer and use it in GitHub Desktop.
Save zarpio/38dbf8128c2c459be7d1 to your computer and use it in GitHub Desktop.
/**
* Provide query string like ?test-mode=1 OR ?test-mode=0
**/
if ( isset( $_GET ) && isset( $_GET['test-mode'] ) ) {
$_SESSION['test-mode'] = $_GET['test-mode'];
}
function isTestMode() {
return $_SESSION['test-mode'];
}
/** display message, when running in test mode. **/
if ( isTestMode() ) {
echo "*** Running in TEST mode ***<br>" . PHP_EOL;
} else {
echo "*** Running in LIVE mode ***<br>" . PHP_EOL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment