change the header image automatically each month with PHP

The PHP function date('M') will return a short textual representation of the month, three letters ‘Jan’ through ‘Dec ‘.

To change the header dependent on the current month just put 12 images named ‘headerJan.png’, ‘headerFeb.png’, ‘headerMar.png’ etc. in the same folder and do something like:

echo '<img src="/images/header'.date('M').'.png" />';

it will then update a new header automatically based on your server date. Nothing too complicated, but a nice touch none-the-less.


About Cameron
I'm a final year Computer Science/Information Systems major. Already finished my BA in Politics/Philosophy. I do web and software freelance on the side, while I finish studying. Hoping to be self-employed by the end of my degree, otherwise off into the real-world I go....

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: