This can be used in advertisements random banners are rotated with page refresh
Here I have taken 3 images of water falls named as pic1,pic2 and pic3 stored them in images folder created in web root then I have created following simple php file using rand function.
<?php $result_random = rand(1, 100); if($result_random <= 70){ echo "<img src='images/pic1.jpg'>"; } else if($result_random <= 90){ echo "<img src='images/pic2.jpg'>"; } else { echo "<img src='images/pic3.jpg'>"; } ?> |
No comments:
Post a Comment