Making a Dynamic Copyright With PHP
Posted on February 23, 2011 in Tutorials
I though I'd just write a quick tutorial on how I make a dynamic copyright for my websites. If you don't know what a function does in the code, look it up on the PHP manual.
<?php echo strftime('%Y', time()); ?>
That's the year generating code. It's just grabbing the year from the current timestamp. So we could do something like this in the copyright:
© <?php echo strftime('%Y', time()); ?> Legion of Weirdos.
You might want to wrap around the code in a helper function:
<?php
function year()
{
return strftime('%Y', time());
}
?>
Anyway, that's all folks.
Tagged in PHP, time, web development, quick tips
blog comments powered by Disqus