Skip to content

Instantly share code, notes, and snippets.

@devluis
Created September 26, 2013 04:14
Show Gist options
  • Save devluis/6709785 to your computer and use it in GitHub Desktop.
Save devluis/6709785 to your computer and use it in GitHub Desktop.
Show random image when refresh page
<?php
srand( microtime() * 10000 );
$num = rand( 1, 3 ); # Random range
switch( $num ){
case 1: $image_file = "mi-imagen-1.jpg";
break;
case 2: $image_file = "mi-imagen-2.jpg";
break;
case 3: $image_file = "mi-imagen-3.jpg";
break;
}
echo $image_file;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment