Display different image each day of the week

This PHP script will get the day of the week from the server date and then display an image (jpg or gif) to match.  Change the name of the image folder, Images must be named Monday.gif, Tuesday.gif etc, Change to the location of the folder containing the images.

 

The code


<?php

/**

 * Change the name of the image folder

 *

 * Images must be named Monday.gif, Tuesday.gif etc

 */

// Change to the location of the folder containing the images

$image_folder "images/days";

// You do not need to edit below this line

$today date('l');

if (file_exists($image_folder."/".$today.".gif")) {

  echo "<img src="$image_folder/".$today.".gif">";

}

else {

  echo "No image was found for $today";

}

?> 

About Bulent

Yes, my name is Bulent. I am originally from Turkey but now reside in United Kingdom. I have been working as a designer for over 8 years and have been very fortunate to have worked on a wide variety of projects. I have recently developed one of the most succesfull recruitment portal for nearly a million Turkish speaking community in UK within few months we had reached to nearly 65,000 users and stil growing. Thank you for stopping by!

Leave a comment

You must be logged in to post a comment.