Below I am going to write a switch command in php. This one starts of with a $img function that randomizes the results between 0 and 5. This will mean that any time the page opens you will get a random number that will out put what is in the CASE associated with that number.
1 Is the Random number generated this time around.
<?php
echo '<style> .switch { max-height: 250px; } </style>';
$img = rand(0,5);
switch ($img):{
case (0):
echo '<img class="switch" src="BKG.jpg">';
break;
case (1):
echo '<img class="switch" src="brick.jpg">';
break;
case (2):
echo '<img class="switch" src="chalk_board.jpg">';
break;
case (3):
echo '<img class="switch" src="Zelda_TriForce.jpg">';
break;
case (4):
echo '<img class="switch" src="ZeldaBkG.jpg">';
break;
default;
echo '<img class="switch" src="RaG.jpg">';
};
echo '<br/>' . $img . ' Is the Random number generated this time around.';
?>
Here is the code in practice
1 Is the Random number generated this time around.