Skip to content

Instantly share code, notes, and snippets.

@trevorgreenleaf
Created August 27, 2013 15:51
Show Gist options
  • Save trevorgreenleaf/6355369 to your computer and use it in GitHub Desktop.
Save trevorgreenleaf/6355369 to your computer and use it in GitHub Desktop.
Create Random bg color in php
// Create Random bg color in php
$rand = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f');
$color = '#'.$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)];
echo '<style> body { background-color:'.$color.'}</style>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment