Nov 10, 2012

Random images with php


Did you visited a website and on reload the blog image changed ?
Well in php that is easy.

Download

<html>
<head>
<title>The Coder Tips | Random Images with php</title>
</head>
<body>
<?php

$rand = rand(1, 5);

if($rand == 1){
echo '<img src="1.jpg">';
}
if($rand == 2){
echo '<img src="2.jpg">';
}
if($rand == 3){
echo '<img src="3.jpg">';
}
if($rand == 4){
echo '<img src="4.jpg">';
}
if($rand == 5){
echo '<img src="5.jpg">';
}

?>
</body>
</html>

1 comment:

  1. ';
    break;
    case 2:
    echo '';
    break;
    // ...
    }
    // Technique 2
    echo '';
    ?>

    WIN !!!

    ReplyDelete