Skip to content

Instantly share code, notes, and snippets.

@samstarling
Created May 31, 2012 19:52
Show Gist options
  • Save samstarling/2845804 to your computer and use it in GitHub Desktop.
Save samstarling/2845804 to your computer and use it in GitHub Desktop.
<?php
// Generate a random number.
$random = rand(0, 2);
// Set up messages, and fetch a random one.
$messages = array(
array("heading" => "foo", "body" => "123"),
array("heading" => "bar", "body" => "456"),
array("heading" => "bad", "body" => "789")
);
$message = $messages[$random];
?>
<html>
<head>
<style>
body.background-0 { background: red; }
body.background-1 { background: green; }
body.background-2 { background: blue; }
</style>
</head>
<body class="background-<?= $random ?>">
<h1><?= $message['heading'] ?></h1>
<p><?= $message['body'] ?></p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment