Created
September 26, 2013 04:14
-
-
Save devluis/6709785 to your computer and use it in GitHub Desktop.
Show random image when refresh page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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